diff --git a/.circleci/config.yml b/.circleci/config.yml index 95000f104e..9ec84ad53f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,6 +15,7 @@ jobs: NUMPY_VERSION: "*" SCIPY_VERSION: "*" SCIKIT_LEARN_VERSION: "*" + JOBLIB_VERSION: "*" MATPLOTLIB_VERSION: "*" steps: diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000..5e2d545938 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,5 @@ +[run] +branch = True +parallel = True +omit = + */nilearn/externals/* diff --git a/.travis.yml b/.travis.yml index 0a6b0a866c..e63407049c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,49 +2,58 @@ sudo: required dist: xenial language: python -python: "3.5" - -virtualenv: - system_site_packages: true env: global: - - TEST_RUN_FOLDER="/tmp" # folder where the tests are run from + - TEST_RUN_FOLDER="/tmp" matrix: # Do not wait for the allowed_failures entry to finish before # setting the status fast_finish: true allow_failures: - # allow_failures seems to be keyed on the python version. - - python: 3.5 + # allow_failures keyed to python 3.5 & skipping tests. + - python: "3.5" + env: DISTRIB="travisci" PYTHON_VERSION="3.5" FLAKE8_VERSION="*" SKIP_TESTS="true" include: - # without matplotlib - - env: DISTRIB="conda" PYTHON_VERSION="3.5" + - name: "Python 3.5 minimum package versions without Matplotlib" + python: "3.5" + env: DISTRIB="travisci" PYTHON_VERSION="3.5" NUMPY_VERSION="1.11" SCIPY_VERSION="0.19" PANDAS_VERSION="*" - SCIKIT_LEARN_VERSION="0.19" COVERAGE="true" + SCIKIT_LEARN_VERSION="0.19" COVERAGE="true" JOBLIB_VERSION="0.11" LXML_VERSION="*" - - env: DISTRIB="conda" PYTHON_VERSION="3.5" + - name: "Python 3.5 latest package versions" + python: "3.5" + env: DISTRIB="travisci" PYTHON_VERSION="3.5" NUMPY_VERSION="*" SCIPY_VERSION="*" PANDAS_VERSION="*" SCIKIT_LEARN_VERSION="*" MATPLOTLIB_VERSION="*" COVERAGE="true" + JOBLIB_VERSION="0.11" LXML_VERSION="*" - - env: DISTRIB="conda" PYTHON_VERSION="3.6" + - name: "Python 3.6 latest package versions" + python: "3.6" + env: DISTRIB="travisci" PYTHON_VERSION="3.6" NUMPY_VERSION="*" SCIPY_VERSION="*" PANDAS_VERSION="*" SCIKIT_LEARN_VERSION="*" MATPLOTLIB_VERSION="*" COVERAGE="true" - LXML_VERSION="*" - - env: DISTRIB="conda" PYTHON_VERSION="3.7" + JOBLIB_VERSION="0.12" LXML_VERSION="*" + # joblib.Memory switches from keyword cachedir to location in version 0.12 + # Making sure we get the deprecation warning. + + - name: "Python 3.7 latest package versions" + python: "3.7" + env: DISTRIB="travisci" PYTHON_VERSION="3.7" NUMPY_VERSION="*" SCIPY_VERSION="*" PANDAS_VERSION="*" SCIKIT_LEARN_VERSION="*" MATPLOTLIB_VERSION="*" COVERAGE="true" - LXML_VERSION="*" + JOBLIB_VERSION="*" LXML_VERSION="*" # FLAKE8 linting on diff wrt common ancestor with upstream/master # Note: the python value is only there to trigger allow_failures - - python: 3.5 - env: DISTRIB="conda" PYTHON_VERSION="3.5" FLAKE8_VERSION="*" SKIP_TESTS="true" + - name: Python 3.5 Flake8 no tests + python: "3.5" + env: DISTRIB="travisci" PYTHON_VERSION="3.5" FLAKE8_VERSION="*" SKIP_TESTS="true" install: source continuous_integration/install.sh -before_script: make clean +before_script: make clean script: source continuous_integration/test_script.sh diff --git a/AUTHORS.rst b/AUTHORS.rst index c67751492c..ed04bc5d1a 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -3,38 +3,36 @@ People ------ -This work is made available by a community of people, amongst which +This work is made available by a community of people, which +originated from the `INRIA Parietal Project Team `_ -and the `scikit-learn `_ folks, in -particular: - -* Alexandre Abraham -* `Alexandre Gramfort `_ -* Vincent Michel -* Bertrand Thirion -* `Fabian Pedregosa `_ -* `Gael Varoquaux `_ -* Philippe Gervais -* Michael Eickenberg -* Danilo Bzdok -* Loïc Estève -* Kamalakar Reddy Daddy -* Elvis Dohmatob -* Alexandre Abadie -* Andres Hoyos Idrobo -* Salma Bougacha -* Mehdi Rahim -* Sylvain Lanuzel -* `Kshitij Chawla `_ - -Many of also contributed outside of Parietal, notably: - -* `Chris Filo Gorgolewski `_ -* `Ben Cipollini `_ -* Julia Huntenburg -* Martin Perez-Guevara - -Thanks to M. Hanke and Y. Halchenko for data and packaging. +and the `scikit-learn `_ but grew much further. + +An up-to-date list of contributors can be seen in on `gitub +`_ + +Additional credit goes to M. Hanke and Y. Halchenko for data and packaging. + +.. _core_devs: + +Core developers +................. + +The nilearn core developers are: + +* Alexandre Gramfort https://github.com/agramfort +* Ben Cipollini https://github.com/bcipolli +* Bertrand Thirion https://github.com/bthirion +* Chris Gorgolewski https://github.com/chrisgorgo +* Danilo Bzdok https://github.com/banilo +* Elizabeth DuPre https://github.com/emdupre +* Gael Varoquaux https://github.com/GaelVaroquaux +* Jerome Dockes https://github.com/jeromedockes +* Julia Huntenburg https://github.com/juhuntenburg +* KamalakerDadi https://github.com/KamalakerDadi +* Kshitij Chawla https://github.com/kchawla-pi +* Medhi Rahim https://github.com/mrahim +* Salma Bougacha https://github.com/salma1601 Funding ........ @@ -45,7 +43,8 @@ Mehdi Rahim, Philippe Gervais where payed by the `NiConnect project, funded by the French `Investissement d'Avenir `_. -NiLearn is also supported by `DigiCosme `_ |digicomse logo| +NiLearn is also supported by `DigiCosme `_ +|digicosme logo| and `DataIA `_ |dataia_logo|. .. _citing: @@ -74,6 +73,10 @@ See the scikit-learn documentation on `how to cite `_. -.. |digicomse logo| image:: logos/digi-saclay-logo-small.png +.. |digicosme logo| image:: logos/digi-saclay-logo-small.png + :height: 25 + :alt: DigiComse Logo + +.. |dataia_logo| image:: logos/dataia.png :height: 25 - :alt: DigiComse Logo \ No newline at end of file + :alt: DataIA Logo diff --git a/Makefile b/Makefile index 15d6f8d4dd..ec14caa46b 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,6 @@ PYTHON ?= python CYTHON ?= cython -NOSETESTS ?= nosetests -NOSETESTS_OPTIONS := $(shell pip list | grep nose-timer > /dev/null && \ - echo '--with-timer --timer-top-n 50') CTAGS ?= ctags all: clean test doc-noplot @@ -32,15 +29,15 @@ inplace: $(PYTHON) setup.py build_ext -i test-code: - $(NOSETESTS) -s nilearn $(NOSETESTS_OPTIONS) + python -m pytest --pyargs nilearn --cov=nilearn + test-doc: - $(NOSETESTS) -s --with-doctest --doctest-tests --doctest-extension=rst \ - --doctest-extension=inc --doctest-fixtures=_fixture `find doc/ -name '*.rst'` + pytest --doctest-glob='*.rst' `find doc/ -name '*.rst'` + test-coverage: rm -rf coverage .coverage - $(NOSETESTS) -s --with-coverage --cover-html --cover-html-dir=coverage \ - --cover-package=nilearn nilearn + pytest --pyargs nilearn --showlocals --cov=nilearn --cov-report=html:coverage test: test-code test-doc @@ -66,4 +63,3 @@ doc: .PHONY : pdf pdf: make -C doc pdf - diff --git a/README.rst b/README.rst index f2d1b50d36..e2f42830a9 100644 --- a/README.rst +++ b/README.rst @@ -43,6 +43,7 @@ The required dependencies to use the software are: * Numpy >= 1.11 * SciPy >= 0.19 * Scikit-learn >= 0.19 +* Joblib >= 0.11 * Nibabel >= 2.0.2 If you are using nilearn plotting functionalities or running the diff --git a/appveyor.yml b/appveyor.yml index 605c79581b..ed77a89874 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,10 +24,10 @@ install: # See similar fix which made for travis and circleci # https://github.com/nilearn/nilearn/pull/1525 # Should be removed after a new matplotlib release 2.1.1 - - "conda install pip numpy scipy scikit-learn nose wheel matplotlib -y -q" + - "conda install pip numpy scipy scikit-learn joblib nose pytest wheel matplotlib -y -q" # Install other nilearn dependencies - - "pip install nibabel coverage nose-timer" + - "pip install nibabel coverage nose-timer pytest-cov" - "python setup.py bdist_wheel" - ps: "ls dist" @@ -41,7 +41,7 @@ test_script: # Change to a non-source folder to make sure we run the tests on the # installed library. - "cd C:\\" - - "python -c \"import nose; nose.main()\" -v -s nilearn --with-timer --timer-top-n 50" + - "pytest --pyargs nilearn -v" artifacts: # Archive the generated packages in the ci.appveyor.com build report. diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4601af26a9..5ae4de4c1a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,7 +30,7 @@ jobs: - script: | pip install . - nosetests ./nilearn -v + pytest ./nilearn -v displayName: 'test' - task: PublishTestResults@2 diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..9fd6de2da3 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,2 @@ +ignore: + - "*externals/.*" # ignore folders and all its contents diff --git a/continuous_integration/install.sh b/continuous_integration/install.sh index 43ef8eaf4b..a387010a74 100755 --- a/continuous_integration/install.sh +++ b/continuous_integration/install.sh @@ -22,21 +22,20 @@ create_new_venv() { deactivate virtualenv --system-site-packages testvenv source testvenv/bin/activate - pip install nose + pip install nose pytest } -print_conda_requirements() { - # Echo a conda requirement string for example +echo_requirements_string() { + # Echo a requirement string for example # "pip nose python='2.7.3 scikit-learn=*". It has a hardcoded # list of possible packages to install and looks at _VERSION # environment variables to know whether to install a given package and # if yes which version to install. For example: # - for numpy, NUMPY_VERSION is used # - for scikit-learn, SCIKIT_LEARN_VERSION is used - TO_INSTALL_ALWAYS="pip nose" + TO_INSTALL_ALWAYS="pip nose pytest" REQUIREMENTS="$TO_INSTALL_ALWAYS" - TO_INSTALL_MAYBE="python numpy scipy matplotlib scikit-learn pandas \ -flake8 lxml" + TO_INSTALL_MAYBE="numpy scipy matplotlib scikit-learn pandas flake8 lxml joblib" for PACKAGE in $TO_INSTALL_MAYBE; do # Capitalize package name and add _VERSION PACKAGE_VERSION_VARNAME="${PACKAGE^^}_VERSION" @@ -45,44 +44,25 @@ flake8 lxml" # dereference $PACKAGE_VERSION_VARNAME to figure out the # version to install PACKAGE_VERSION="${!PACKAGE_VERSION_VARNAME}" - if [ -n "$PACKAGE_VERSION" ]; then - REQUIREMENTS="$REQUIREMENTS $PACKAGE=$PACKAGE_VERSION" + if [[ -n "$PACKAGE_VERSION" ]]; then + if [[ "$PACKAGE_VERSION" == "*" ]]; then + REQUIREMENTS="$REQUIREMENTS $PACKAGE" + else + REQUIREMENTS="$REQUIREMENTS $PACKAGE==$PACKAGE_VERSION" + fi fi done echo $REQUIREMENTS } -create_new_conda_env() { - # Skip Travis related code on circle ci. - if [ -z $CIRCLECI ]; then - # Deactivate the travis-provided virtual environment and setup a - # conda-based environment instead - deactivate - fi - - # Use the miniconda installer for faster download / install of conda - # itself - wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ - -O ~/miniconda.sh - chmod +x ~/miniconda.sh && ~/miniconda.sh -b - export PATH=$HOME/miniconda3/bin:$PATH - echo $PATH - - # Configure the conda environment and put it in the path using the - # provided versions - REQUIREMENTS=$(print_conda_requirements) - echo "conda requirements string: $REQUIREMENTS" - conda create -n testenv --quiet --yes $REQUIREMENTS - source activate testenv +create_new_travisci_env() { + REQUIREMENTS=$(echo_requirements_string) + pip install ${REQUIREMENTS} + pip install pytest pytest-cov if [[ "$INSTALL_MKL" == "true" ]]; then # Make sure that MKL is used - conda install --quiet --yes mkl - elif [[ -z $CIRCLECI ]]; then - # Travis doesn't use MKL but circle ci does for speeding up examples - # generation in the html documentation. - # Make sure that MKL is not used - conda remove --yes --features mkl || echo "MKL not installed" + pip install mkl fi } @@ -90,16 +70,16 @@ if [[ "$DISTRIB" == "neurodebian" ]]; then create_new_venv pip install nose-timer bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh) - sudo apt-get install -qq python-scipy python-nose python-nibabel python-sklearn + sudo apt-get install -qq python-scipy python-nose python-nibabel python-sklearn python-joblib -elif [[ "$DISTRIB" == "conda" ]]; then - create_new_conda_env +elif [[ "$DISTRIB" == "travisci" ]]; then + create_new_travisci_env pip install nose-timer # Note: nibabel is in setup.py install_requires so nibabel will # always be installed eventually. Defining NIBABEL_VERSION is only # useful if you happen to want a specific nibabel version rather # than the latest available one. - if [ -n "$NIBABEL_VERSION" ]; then + if [[ -n "$NIBABEL_VERSION" ]]; then pip install nibabel=="$NIBABEL_VERSION" fi diff --git a/continuous_integration/show-python-packages-versions.py b/continuous_integration/show-python-packages-versions.py index 1822dd172e..3c2f3319a3 100644 --- a/continuous_integration/show-python-packages-versions.py +++ b/continuous_integration/show-python-packages-versions.py @@ -1,6 +1,6 @@ import sys -DEPENDENCIES = ['numpy', 'scipy', 'sklearn', 'matplotlib', 'nibabel'] +DEPENDENCIES = ['numpy', 'scipy', 'sklearn', 'joblib', 'matplotlib', 'nibabel'] def print_package_version(package_name, indent=' '): diff --git a/continuous_integration/test_script.sh b/continuous_integration/test_script.sh index 1dfa2578d1..4fbb32ba2e 100755 --- a/continuous_integration/test_script.sh +++ b/continuous_integration/test_script.sh @@ -11,6 +11,7 @@ if [[ "$SKIP_TESTS" != "true" ]]; then # Copy setup.cfg to TEST_RUN_FOLDER where we are going to run the tests from # Mainly for nose config settings cp setup.cfg "$TEST_RUN_FOLDER" + cp .coveragerc "$TEST_RUN_FOLDER" # We want to back out of the current working directory to make # sure we are using nilearn installed in site-packages rather # than the one from the current working directory diff --git a/doc/conf.py b/doc/conf.py index 3f88540004..392ccb353d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -281,13 +281,18 @@ _python_doc_base = 'http://docs.python.org/3.6' +# Scraper, copied from https://github.com/mne-tools/mne-python/ +from nilearn.reporting import _ReportScraper +report_scraper = _ReportScraper() +scrapers = ('matplotlib', report_scraper) + # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { 'python': (_python_doc_base, None), 'numpy': ('http://docs.scipy.org/doc/numpy', None), 'scipy': ('http://docs.scipy.org/doc/scipy/reference', None), 'matplotlib': ('http://matplotlib.org/', None), - 'sklearn': ('http://scikit-learn.org/0.18', None), + 'sklearn': ('http://scikit-learn.org/stable/', None), 'nibabel': ('http://nipy.org/nibabel', None), 'pandas': ('http://pandas.pydata.org', None), } @@ -302,6 +307,7 @@ 'backreferences_dir': os.path.join('modules', 'generated'), 'reference_url': {'nilearn': None}, 'junit': '../test-results/sphinx-gallery/junit.xml', + 'image_scrapers': scrapers, } # Get rid of spurious warnings due to some interaction between @@ -310,7 +316,6 @@ # details numpydoc_show_class_members = False - def touch_example_backreferences(app, what, name, obj, options, lines): # generate empty examples files, so that we don't get # inclusion errors if there are no examples for a class / module @@ -327,3 +332,4 @@ def touch_example_backreferences(app, what, name, obj, options, lines): def setup(app): app.add_javascript('copybutton.js') app.connect('autodoc-process-docstring', touch_example_backreferences) + report_scraper.app = app diff --git a/doc/connectivity/connectome_extraction.rst b/doc/connectivity/connectome_extraction.rst index 6707f081d4..fb62356326 100644 --- a/doc/connectivity/connectome_extraction.rst +++ b/doc/connectivity/connectome_extraction.rst @@ -49,12 +49,12 @@ conditioned on all the others. To recover well the interaction structure, a **sparse inverse covariance -estimator** is necessary. The GraphLasso, implemented in scikit-learn's -estimator :class:`sklearn.covariance.GraphLassoCV` is a good, simple +estimator** is necessary. The GraphicalLasso, implemented in scikit-learn's +estimator :class:`sklearn.covariance.GraphicalLassoCV` is a good, simple solution. To use it, you need to create an estimator object:: - >>> from sklearn.covariance import GraphLassoCV - >>> estimator = GraphLassoCV() + >>> from sklearn.covariance import GraphicalLassoCV + >>> estimator = GraphicalLassoCV() And then you can fit it on the activation time series, for instance extracted in :ref:`the previous section `:: @@ -95,7 +95,7 @@ of the estimator:: The parameter controlling the sparsity is set by `cross-validation `_ scheme. If you want to specify it manually, use the estimator - :class:`sklearn.covariance.GraphLasso`. + :class:`sklearn.covariance.GraphicalLasso`. .. topic:: **Full example** @@ -126,7 +126,7 @@ differing connection values across subjects. For this, nilearn provides the :class:`nilearn.connectome.GroupSparseCovarianceCV` -estimator. Its usage is similar to the GraphLassoCV object, but it takes +estimator. Its usage is similar to the GraphicalLassoCV object, but it takes a list of time series:: >>> estimator.fit([time_series_1, time_series_2, ...]) # doctest: +SKIP @@ -186,7 +186,7 @@ with different precision matrices, but sharing a common sparsity pattern: 10 brain regions, for 20 subjects. A single-subject estimation can be performed using the -:class:`sklearn.covariance.GraphLassoCV` estimator from scikit-learn. +:class:`sklearn.covariance.GraphicalLassoCV` estimator from scikit-learn. It is also possible to fit a graph lasso on data from every subject all together. diff --git a/doc/developers/group_sparse_covariance.rst b/doc/developers/group_sparse_covariance.rst index 56e15e1c45..b95eadf867 100644 --- a/doc/developers/group_sparse_covariance.rst +++ b/doc/developers/group_sparse_covariance.rst @@ -369,7 +369,7 @@ used), then a tighter grid near the found maximum is computed, and so on. This allows for a very precise determination of the maximum location while reducing a lot the required evaluation number. The code is very close to what is done in -:class:`sklearn.covariance.GraphLassoCV`. +:class:`sklearn.covariance.GraphicalLassoCV`. Warm restart diff --git a/doc/development.rst b/doc/development.rst index a0ea29cdd6..4edac4347f 100644 --- a/doc/development.rst +++ b/doc/development.rst @@ -122,12 +122,9 @@ Decisions are made public, through discussion on issues and pull requests in Github. The decisions are made by the core-contributors, ie people with write -access to the repository, as listed `here -`__ +access to the repository, as listed :ref:`here ` If there are open questions, final decisions are made by the Temporary Benevolent Dictator, currently Gaël Varoquaux. - - .. include:: ../CONTRIBUTING.rst diff --git a/doc/images/niftimasker_report.png b/doc/images/niftimasker_report.png new file mode 100644 index 0000000000..664469b9a3 Binary files /dev/null and b/doc/images/niftimasker_report.png differ diff --git a/doc/images/niftimasker_report_params.png b/doc/images/niftimasker_report_params.png new file mode 100644 index 0000000000..7528695bcf Binary files /dev/null and b/doc/images/niftimasker_report_params.png differ diff --git a/doc/install_doc_component.html b/doc/install_doc_component.html index c6584d3961..d1e97934b9 100644 --- a/doc/install_doc_component.html +++ b/doc/install_doc_component.html @@ -53,7 +53,8 @@ as an alternative.

Nilearn requires a Python installation and the following - dependencies: ipython, scipy, scikit-learn, matplotlib and nibabel.

+ dependencies: ipython, scipy, scikit-learn, joblib, matplotlib + and nibabel.

Second: open a Command Prompt

(Press "Win-R", type "cmd" and press "Enter". This will open @@ -83,7 +84,8 @@ it will save you time and trouble.

Nilearn requires a Python installation and the following - dependencies: ipython, scipy, scikit-learn, matplotlib and nibabel.

+ dependencies: ipython, scipy, scikit-learn, joblib, + matplotlib and nibabel.

Second: open a Terminal

(Navigate to /Applications/Utilities and double-click on @@ -114,7 +116,8 @@

Install or ask your system administrator to install the following packages using the distribution package manager: ipython , scipy, scikit-learn (sometimes called sklearn, - or python-sklearn), matplotlib (sometimes + or python-sklearn), joblib, + matplotlib (sometimes called python-matplotlib) and nibabel (sometimes called python-nibabel).

diff --git a/doc/logos/dataia.png b/doc/logos/dataia.png new file mode 100644 index 0000000000..fae26199d3 Binary files /dev/null and b/doc/logos/dataia.png differ diff --git a/doc/manipulating_images/masker_objects.rst b/doc/manipulating_images/masker_objects.rst index fa77719bda..dc2f06dafd 100644 --- a/doc/manipulating_images/masker_objects.rst +++ b/doc/manipulating_images/masker_objects.rst @@ -136,12 +136,25 @@ mask computation parameters. The mask can be retrieved and visualized from the `mask_img_` attribute of the masker: +.. literalinclude:: ../../examples/04_manipulating_images/plot_mask_computation.py + :start-after: # A NiftiMasker with the default strategy + :end-before: # Plot the generated mask using the .generate_report method + +.. figure:: ../auto_examples/04_manipulating_images/images/sphx_glr_plot_mask_computation_002.png + :target: ../auto_examples/04_manipulating_images/plot_mask_computation.html + :align: center + :scale: 40 + +Alternatively, the mask can be visualized using the `generate_report` +method of the masker. The generated report can be viewed in a Jupyter notebook, +opened in a new browser tab using `report.open_in_browser()`, +or saved as a portable HTML file `report.save_as_html(output_filepath)`. + .. literalinclude:: ../../examples/04_manipulating_images/plot_mask_computation.py :start-after: # We need to specify an 'epi' mask_strategy, as this is raw EPI data :end-before: # Generate mask with strong opening - -.. figure:: ../auto_examples/04_manipulating_images/images/sphx_glr_plot_mask_computation_004.png +.. figure:: /images/niftimasker_report.png :target: ../auto_examples/04_manipulating_images/plot_mask_computation.html :scale: 50% @@ -163,7 +176,7 @@ Controling these arguments set the fine aspects of the mask. See the functions documentation, or :doc:`the NiftiMasker example <../auto_examples/04_manipulating_images/plot_mask_computation>`. -.. figure:: ../auto_examples/04_manipulating_images/images/sphx_glr_plot_mask_computation_005.png +.. figure:: /images/niftimasker_report_params.png :target: ../auto_examples/04_manipulating_images/plot_mask_computation.html :scale: 50% @@ -180,9 +193,10 @@ preparation:: >>> masker # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE NiftiMasker(detrend=False, dtype=None, high_pass=None, low_pass=None, mask_args=None, mask_img=None, mask_strategy='background', - memory=Memory(...), memory_level=1, sample_mask=None, - sessions=None, smoothing_fwhm=None, standardize=False, t_r=None, - target_affine=None, target_shape=None, verbose=0) + memory=Memory(...), memory_level=1, reports=True, + sample_mask=None, sessions=None, smoothing_fwhm=None, + standardize=False, t_r=None, target_affine=None, target_shape=None, + verbose=0) .. note:: @@ -234,7 +248,7 @@ Temporal Filtering and confound removal properties, before conversion to voxel signals. - **Standardization**. Parameter ``standardize``: Signals can be - standardized (scaled to unit variance). + standardized (scaled to unit variance). - **Frequency filtering**. Low-pass and high-pass filters can be used to remove artifacts. Parameters: ``high_pass`` and ``low_pass``, specified @@ -242,7 +256,7 @@ properties, before conversion to voxel signals. the ``t_r`` parameter: ``loss_pass=.5, t_r=2.1``). - **Confound removal**. Two ways of removing confounds are provided: simple - detrending or using prespecified confounds, such as behavioral or movement + detrending or using prespecified confounds, such as behavioral or movement information. * Linear trends can be removed by activating the `detrend` parameter. @@ -251,7 +265,7 @@ properties, before conversion to voxel signals. signal of interest (e.g., the neural correlates of cognitive tasks). It is not activated by default in :class:`NiftiMasker` but is recommended in almost all scenarios. - + * More complex confounds, measured during the acquision, can be removed by passing them to :meth:`NiftiMasker.transform`. If the dataset provides a confounds file, just pass its path to the masker. diff --git a/doc/themes/nilearn/static/nature.css_t b/doc/themes/nilearn/static/nature.css_t index 6d5c73b8ff..7397860e39 100644 --- a/doc/themes/nilearn/static/nature.css_t +++ b/doc/themes/nilearn/static/nature.css_t @@ -1689,3 +1689,22 @@ ul#tab li div.contents p{ p.sphx-glr-horizontal { margin-top: 2em; } + + +/* Sphinx-gallery Report embedding */ +div.sg-report { + padding: 0pt; + transform: scale(.95); +} + +div.sg-report iframe { + display: block; + border-style: none; + transform: scale(.85); + height: 470px; + margin-left: -12%; /* Negative because of .8 scaling */ + margin-top: -4%; + padding: 0pt; + margin-bottom: 0pt; + width: 126%; /* More than 100% because of .8 scaling */ +} diff --git a/doc/themes/nilearn/static/sphinxdoc.css b/doc/themes/nilearn/static/sphinxdoc.css deleted file mode 100644 index b680a95710..0000000000 --- a/doc/themes/nilearn/static/sphinxdoc.css +++ /dev/null @@ -1,339 +0,0 @@ -/* - * sphinxdoc.css_t - * ~~~~~~~~~~~~~~~ - * - * Sphinx stylesheet -- sphinxdoc theme. Originally created by - * Armin Ronacher for Werkzeug. - * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -@import url("basic.css"); - -/* -- page layout ----------------------------------------------------------- */ - -body { - font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', - 'Verdana', sans-serif; - font-size: 14px; - letter-spacing: -0.01em; - line-height: 150%; - text-align: center; - background-color: #BFD1D4; - color: black; - padding: 0; - border: 1px solid #aaa; - - margin: 0px 80px 0px 80px; - min-width: 740px; -} - -div.document { - background-color: white; - text-align: left; - background-image: url(contents.png); - background-repeat: repeat-x; -} - -div.bodywrapper { - margin: 0 240px 0 0; - border-right: 1px solid #ccc; -} - -div.body { - margin: 0; - padding: 0.5em 20px 20px 20px; -} - -div.related { - font-size: 1em; -} - -div.related ul { - background-image: url(navigation.png); - height: 2em; - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; -} - -div.related ul li { - margin: 0; - padding: 0; - height: 2em; - float: left; -} - -div.related ul li.right { - float: right; - margin-right: 5px; -} - -div.related ul li a { - margin: 0; - padding: 0 5px 0 5px; - line-height: 1.75em; - color: #EE9816; -} - -div.related ul li a:hover { - color: #3CA8E7; -} - -div.sphinxsidebarwrapper { - padding: 0; -} - -div.sphinxsidebar { - margin: 0; - padding: 0.5em 15px 15px 0; - width: 210px; - float: right; - font-size: 1em; - text-align: left; -} - -div.sphinxsidebar h3, div.sphinxsidebar h4 { - margin: 1em 0 0.5em 0; - font-size: 1em; - padding: 0.1em 0 0.1em 0.5em; - color: white; - border: 1px solid #86989B; - background-color: #AFC1C4; -} - -div.sphinxsidebar h3 a { - color: white; -} - -div.sphinxsidebar ul { - padding-left: 1.5em; - margin-top: 7px; - padding: 0; - line-height: 130%; -} - -div.sphinxsidebar ul ul { - margin-left: 20px; -} - -div.footer { - background-color: #E3EFF1; - color: #86989B; - padding: 3px 8px 3px 0; - clear: both; - font-size: 0.8em; - text-align: right; -} - -div.footer a { - color: #86989B; - text-decoration: underline; -} - -/* -- body styles ----------------------------------------------------------- */ - -p { - margin: 0.8em 0 0.5em 0; -} - -a { - color: #CA7900; - text-decoration: none; -} - -a:hover { - color: #2491CF; -} - -div.body a { - text-decoration: underline; -} - -h1 { - margin: 0; - padding: 0.7em 0 0.3em 0; - font-size: 1.5em; - color: #11557C; -} - -h2 { - margin: 1.3em 0 0.2em 0; - font-size: 1.35em; - padding: 0; -} - -h3 { - margin: 1em 0 -0.3em 0; - font-size: 1.2em; -} - -div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a { - color: black!important; -} - -h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor { - display: none; - margin: 0 0 0 0.3em; - padding: 0 0.2em 0 0.2em; - color: #aaa!important; -} - -h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, -h5:hover a.anchor, h6:hover a.anchor { - display: inline; -} - -h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover, -h5 a.anchor:hover, h6 a.anchor:hover { - color: #777; - background-color: #eee; -} - -a.headerlink { - color: #c60f0f!important; - font-size: 1em; - margin-left: 6px; - padding: 0 4px 0 4px; - text-decoration: none!important; -} - -a.headerlink:hover { - background-color: #ccc; - color: white!important; -} - -cite, code, tt { - font-family: 'Consolas', 'Deja Vu Sans Mono', - 'Bitstream Vera Sans Mono', monospace; - font-size: 0.95em; - letter-spacing: 0.01em; -} - -tt { - background-color: #f2f2f2; - border-bottom: 1px solid #ddd; - color: #333; -} - -tt.descname, tt.descclassname, tt.xref { - border: 0; -} - -hr { - border: 1px solid #abc; - margin: 2em; -} - -a tt { - border: 0; - color: #CA7900; -} - -a tt:hover { - color: #2491CF; -} - -pre { - font-family: 'Consolas', 'Deja Vu Sans Mono', - 'Bitstream Vera Sans Mono', monospace; - font-size: 0.95em; - letter-spacing: 0.015em; - line-height: 120%; - padding: 0.5em; - border: 1px solid #ccc; - background-color: #f8f8f8; -} - -pre a { - color: inherit; - text-decoration: underline; -} - -td.linenos pre { - padding: 0.5em 0; -} - -div.quotebar { - background-color: #f8f8f8; - max-width: 250px; - float: right; - padding: 2px 7px; - border: 1px solid #ccc; -} - -div.topic { - background-color: #f8f8f8; -} - -table { - border-collapse: collapse; - margin: 0 -0.5em 0 -0.5em; -} - -table td, table th { - padding: 0.2em 0.5em 0.2em 0.5em; -} - -div.admonition, div.warning { - font-size: 0.9em; - margin: 1em 0 1em 0; - border: 1px solid #86989B; - background-color: #f7f7f7; - padding: 0; -} - -div.admonition p, div.warning p { - margin: 0.5em 1em 0.5em 1em; - padding: 0; -} - -div.admonition pre, div.warning pre { - margin: 0.4em 1em 0.4em 1em; -} - -div.admonition p.admonition-title, -div.warning p.admonition-title { - margin: 0; - padding: 0.1em 0 0.1em 0.5em; - color: white; - border-bottom: 1px solid #86989B; - font-weight: bold; - background-color: #AFC1C4; -} - -div.warning { - border: 1px solid #940000; -} - -div.warning p.admonition-title { - background-color: #CF0000; - border-bottom-color: #940000; -} - -div.admonition ul, div.admonition ol, -div.warning ul, div.warning ol { - margin: 0.1em 0.5em 0.5em 3em; - padding: 0; -} - -div.versioninfo { - margin: 1em 0 0 0; - border: 1px solid #ccc; - background-color: #DDEAF0; - padding: 8px; - line-height: 1.3em; - font-size: 0.9em; -} - -.viewcode-back { - font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', - 'Verdana', sans-serif; -} - -div.viewcode-block:target { - background-color: #f4debf; - border-top: 1px solid #ac9; - border-bottom: 1px solid #ac9; -} \ No newline at end of file diff --git a/doc/whats_new.rst b/doc/whats_new.rst index ae194fa602..a96d2dd40f 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -13,6 +13,11 @@ NEW | - Scikit-learn -- v0.19 | - Scipy -- v0.19 +- A new method for :class:`nilearn.input_data.NiftiMasker` instances + for generating reports viewable in a web browser, Jupyter Notebook, or VSCode. + +- joblib is now a dependency + - Parcellation method ReNA: Fast agglomerative clustering based on recursive nearest neighbor grouping. Yields very fast & accurate models, without creation of giant @@ -28,6 +33,12 @@ NEW :func:`nilearn.datasets.fetch_development_fmri` can be used to download movie-watching data in children and adults. A light-weight dataset implemented for teaching and usage in the examples. +- New example in `examples/05_advanced/plot_age_group_prediction_cross_val.py` + to compare methods for classifying subjects into age groups based on + functional connectivity. Similar example in + `examples/03_connectivity/plot_group_level_connectivity.py` simplified. + +- the Localizer dataset now follows the BIDS organization. Changes ------- @@ -39,7 +50,17 @@ Changes and :func:`nilearn.plotting.view_connectome` now allow disabling the colorbar, and setting its height and the fontsize of its ticklabels. +- :func:`nilearn.plotting.view_img_on_surf`, :func:`nilearn.plotting.view_surf` + and :func:`nilearn.plotting.view_connectome` can now display a title. + +- Rework of the standardize-options of :func:`nilearn.signal.clean` and the various Maskers + in `nilearn.input_data`. You can now set `standardize` to `zscore` or `psc`. `psc` stands + for `Percent Signal Change`, which can be a meaningful metric for BOLD. +- :func:`nilearn.plotting.plot_img` now has explicit keyword arguments `bg_img`, + `vmin` and `vmax` to control the background image and the bounds of the + colormap. These arguments were already accepted in `kwargs` but not documented + before. Fixes ----- @@ -56,8 +77,17 @@ Fixes half-transparent grey to maintain a 3D perception. - :func:`nilearn.plotting.view_surf` now accepts surface data provided as a file path. -- plot_glass_brain now correctly displays the left 'l' orientation even when +- :func:`nilearn.plotting.plot_glass_brain` now correctly displays the left 'l' orientation even when the given images are completely masked (empty images). +- :func:`nilearn.plotting.plot_matrix` providing labels=None, False, or an empty list now correctly disables labels. +- :func:`nilearn.plotting.plot_surf_roi` now takes vmin, vmax parameters +- :func:`nilearn.datasets.fetch_surf_nki_enhanced` is now downloading the correct + left and right functional surface data for each subject +- :func:`nilearn.datasets.fetch_atlas_schaefer_2018` now downloads from release + version 0.14.3 (instead of 0.8.1) by default, which includes corrected region label + names along with 700 and 900 region parcelations. +- Colormap creation functions have been updated to avoid matplotlib deprecation warnings + about colormap reversal 0.5.2 ===== diff --git a/examples/01_plotting/plot_3d_map_to_surface_projection.py b/examples/01_plotting/plot_3d_map_to_surface_projection.py index c8d08a0e6e..0b01f4197e 100644 --- a/examples/01_plotting/plot_3d_map_to_surface_projection.py +++ b/examples/01_plotting/plot_3d_map_to_surface_projection.py @@ -85,15 +85,16 @@ view = plotting.view_surf(fsaverage.infl_right, texture, threshold='90%', bg_map=fsaverage.sulc_right) -# uncomment this to open the plot in a web browser: -# view.open_in_browser() -############################################################################## # In a Jupyter notebook, if ``view`` is the output of a cell, it will # be displayed below the cell - view +############################################################################## + +# uncomment this to open the plot in a web browser: +# view.open_in_browser() + ############################################################################## # We don't need to do the projection ourselves, we can use view_img_on_surf: diff --git a/examples/01_plotting/plot_demo_plotting.py b/examples/01_plotting/plot_demo_plotting.py index 629864a913..9123648522 100644 --- a/examples/01_plotting/plot_demo_plotting.py +++ b/examples/01_plotting/plot_demo_plotting.py @@ -33,6 +33,7 @@ motor_images = datasets.fetch_neurovault_motor_task() stat_img = motor_images.images[0] + ############################################################################### # Plotting statistical maps with function `plot_stat_map` # -------------------------------------------------------- @@ -54,15 +55,15 @@ # for more details. view = plotting.view_img(stat_img, threshold=3) +# In a Jupyter notebook, if ``view`` is the output of a cell, it will +# be displayed below the cell +view + +############################################################################## # uncomment this to open the plot in a web browser: # view.open_in_browser() -############################################################################## -# In a Jupyter notebook, if ``view`` is the output of a cell, it will -# be displayed below the cell - -view ############################################################################### # Plotting statistical maps in a glass brain with function `plot_glass_brain` diff --git a/examples/01_plotting/plot_dim_plotting.py b/examples/01_plotting/plot_dim_plotting.py index afecc379c3..11253a33ad 100644 --- a/examples/01_plotting/plot_dim_plotting.py +++ b/examples/01_plotting/plot_dim_plotting.py @@ -21,9 +21,9 @@ localizer_dataset = datasets.fetch_localizer_button_task() # Contrast map of motor task -localizer_tmap_filename = localizer_dataset.tmap +localizer_tmap_filename = localizer_dataset.tmaps[0] # Subject specific anatomical image -localizer_anat_filename = localizer_dataset.anat +localizer_anat_filename = localizer_dataset.anats[0] ########################################################################### # Plotting with enhancement of background image with dim=-.5 # -------------------------------------------------------------------------- diff --git a/examples/01_plotting/plot_surf_atlas.py b/examples/01_plotting/plot_surf_atlas.py index 90fb6996dd..85b35a3dab 100644 --- a/examples/01_plotting/plot_surf_atlas.py +++ b/examples/01_plotting/plot_surf_atlas.py @@ -124,14 +124,14 @@ view = plotting.view_surf(fsaverage.infl_left, parcellation, cmap='gist_ncar', symmetric_cmap=False) -# uncomment this to open the plot in a web browser: -# view.open_in_browser() - -############################################################################## # In a Jupyter notebook, if ``view`` is the output of a cell, it will # be displayed below the cell view +############################################################################## + +# uncomment this to open the plot in a web browser: +# view.open_in_browser() ############################################################################## # you can also use :func:`nilearn.plotting.view_connectome` to open an diff --git a/examples/02_decoding/plot_haxby_stimuli.py b/examples/02_decoding/plot_haxby_stimuli.py index ba63648a27..ac72643b92 100644 --- a/examples/02_decoding/plot_haxby_stimuli.py +++ b/examples/02_decoding/plot_haxby_stimuli.py @@ -7,7 +7,6 @@ Cortex" (Science 2001) """ -from scipy.misc import imread import matplotlib.pyplot as plt from nilearn import datasets @@ -16,22 +15,19 @@ haxby_dataset = datasets.fetch_haxby(subjects=[], fetch_stimuli=True) stimulus_information = haxby_dataset.stimuli -for stim_type in sorted(stimulus_information.keys()): - if stim_type == b'controls': - # skip control images, there are too many - continue - - file_names = stimulus_information[stim_type] - - plt.figure() - for i in range(48): - plt.subplot(6, 8, i + 1) - try: - plt.imshow(imread(file_names[i]), cmap=plt.cm.gray) - except: - # just go to the next one if the file is not present - pass - plt.axis("off") - plt.suptitle(stim_type) +for stim_type in stimulus_information: + # skip control images, there are too many + if stim_type != 'controls': + + file_names = stimulus_information[stim_type] + + fig, axes = plt.subplots(6, 8) + fig.suptitle(stim_type) + + for img_path, ax in zip(file_names, axes.ravel()): + ax.imshow(plt.imread(img_path), cmap=plt.cm.gray) + + for ax in axes.ravel(): + ax.axis("off") show() diff --git a/examples/02_decoding/plot_miyawaki_encoding.py b/examples/02_decoding/plot_miyawaki_encoding.py index 8520076823..e0e3b3697b 100644 --- a/examples/02_decoding/plot_miyawaki_encoding.py +++ b/examples/02_decoding/plot_miyawaki_encoding.py @@ -152,7 +152,7 @@ # bring the scores into the shape of the background brain score_map_img = masker.inverse_transform(cut_score) -thresholded_score_map_img = threshold_img(score_map_img, threshold=1e-6) +thresholded_score_map_img = threshold_img(score_map_img, threshold=1e-6, copy=False) ############################################################################## # Plotting the statistical map on a background brain, we mark four voxels diff --git a/examples/03_connectivity/plot_group_level_connectivity.py b/examples/03_connectivity/plot_group_level_connectivity.py index 12542f4165..daf21f8f70 100644 --- a/examples/03_connectivity/plot_group_level_connectivity.py +++ b/examples/03_connectivity/plot_group_level_connectivity.py @@ -1,35 +1,17 @@ """ -Functional connectivity matrices for group analysis of connectomes -================================================================== +Classification of age groups using functional connectivity +========================================================== This example compares different kinds of functional connectivity between -regions of interest : correlation, partial correlation, as well as a kind -called **tangent**. +regions of interest : correlation, partial correlation, and tangent space +embedding. The resulting connectivity coefficients can be used to -discriminate children from adults. In general, the **tangent kind** +discriminate children from adults. In general, the tangent space embedding **outperforms** the standard correlations: see `Dadi et al 2019 `_ for a careful study. """ -# Matrix plotting from Nilearn: nilearn.plotting.plot_matrix -import numpy as np -import matplotlib.pylab as plt - - -def plot_matrices(matrices, matrix_kind): - n_matrices = len(matrices) - fig = plt.figure(figsize=(n_matrices * 4, 4)) - for n_subject, matrix in enumerate(matrices): - plt.subplot(1, n_matrices, n_subject + 1) - matrix = matrix.copy() # avoid side effects - # Set diagonal to zero, for better visualization - np.fill_diagonal(matrix, 0) - vmax = np.max(np.abs(matrix)) - title = '{0}, subject {1}'.format(matrix_kind, n_subject) - plotting.plot_matrix(matrix, vmin=-vmax, vmax=vmax, cmap='RdBu_r', - title=title, figure=fig, colorbar=False) - ############################################################################### # Load brain development fMRI dataset and MSDL atlas @@ -37,7 +19,7 @@ def plot_matrices(matrices, matrix_kind): # We study only 30 subjects from the dataset, to save computation time. from nilearn import datasets -rest_data = datasets.fetch_development_fmri(n_subjects=30) +development_dataset = datasets.fetch_development_fmri(n_subjects=30) ############################################################################### # We use probabilistic regions of interest (ROIs) from the MSDL atlas. @@ -57,7 +39,7 @@ def plot_matrices(matrices, matrix_kind): masker = input_data.NiftiMapsMasker( msdl_data.maps, resampling_target="data", t_r=2, detrend=True, - low_pass=.1, high_pass=.01, memory='nilearn_cache', memory_level=1) + low_pass=.1, high_pass=.01, memory='nilearn_cache', memory_level=1).fit() ############################################################################### # Then we compute region signals and extract useful phenotypic informations. @@ -65,13 +47,13 @@ def plot_matrices(matrices, matrix_kind): pooled_subjects = [] groups = [] # child or adult for func_file, confound_file, phenotypic in zip( - rest_data.func, rest_data.confounds, rest_data.phenotypic): - time_series = masker.fit_transform(func_file, confounds=confound_file) + development_dataset.func, + development_dataset.confounds, + development_dataset.phenotypic): + time_series = masker.transform(func_file, confounds=confound_file) pooled_subjects.append(time_series) - is_child = phenotypic['Child_Adult'] == 'child' - if is_child: + if phenotypic['Child_Adult'] == 'child': children.append(time_series) - groups.append(phenotypic['Child_Adult']) print('Data has {0} children.'.format(len(children))) @@ -101,10 +83,14 @@ def plot_matrices(matrices, matrix_kind): print('Mean correlation has shape {0}.'.format(mean_correlation_matrix.shape)) ############################################################################### -# We display the connectome matrices of the first 4 children +# We display the connectome matrices of the first 3 children from nilearn import plotting +from matplotlib import pyplot as plt -plot_matrices(correlation_matrices[:4], 'correlation') +_, axes = plt.subplots(1, 3, figsize=(15, 5)) +for i, (matrix, ax) in enumerate(zip(correlation_matrices, axes)): + plotting.plot_matrix(matrix, tri='lower', colorbar=False, axes=ax, + title='correlation, child {}'.format(i)) ############################################################################### # The blocks structure that reflect functional networks are visible. @@ -119,19 +105,17 @@ def plot_matrices(matrices, matrix_kind): # We can also study **direct connections**, revealed by partial correlation # coefficients. We just change the `ConnectivityMeasure` kind partial_correlation_measure = ConnectivityMeasure(kind='partial correlation') - -############################################################################### -# and repeat the previous operation. partial_correlation_matrices = partial_correlation_measure.fit_transform( children) ############################################################################### -# Most of direct connections are weaker than full connections, -plot_matrices(partial_correlation_matrices[:4], 'partial') +# Most of direct connections are weaker than full connections. +_, axes = plt.subplots(1, 3, figsize=(15, 5)) +for i, (matrix, ax) in enumerate(zip(partial_correlation_matrices, axes)): + plotting.plot_matrix(matrix, tri='lower', colorbar=False, axes=ax, + title='partial correlation, child {}'.format(i)) ############################################################################### -# Compared to a connectome computed on correlations, the connectome graph -# with partial correlations is more sparse: plotting.plot_connectome( partial_correlation_measure.mean_, msdl_coords, title='mean partial correlation over all children') @@ -140,8 +124,8 @@ def plot_matrices(matrices, matrix_kind): # Extract subjects variabilities around a group connectivity # ---------------------------------------------------------- # We can use **both** correlations and partial correlations to capture -# reproducible connectivity patterns at the group-level and build a **robust** -# **group connectivity matrix**. This is done by the **tangent** kind. +# reproducible connectivity patterns at the group-level. +# This is done by the tangent space embedding. tangent_measure = ConnectivityMeasure(kind='tangent') ############################################################################### @@ -154,84 +138,80 @@ def plot_matrices(matrices, matrix_kind): # `tangent_matrices` model individual connectivities as # **perturbations** of the group connectivity matrix `tangent_measure.mean_`. # Keep in mind that these subjects-to-group variability matrices do not -# straight reflect individual brain connections. For instance negative +# directly reflect individual brain connections. For instance negative # coefficients can not be interpreted as anticorrelated regions. -plot_matrices(tangent_matrices[:4], 'tangent variability') +_, axes = plt.subplots(1, 3, figsize=(15, 5)) +for i, (matrix, ax) in enumerate(zip(tangent_matrices, axes)): + plotting.plot_matrix(matrix, tri='lower', colorbar=False, axes=ax, + title='tangent offset, child {}'.format(i)) + ############################################################################### -# The average tangent matrix cannot be interpreted, as the average -# variation is expected to be zero +# The average tangent matrix cannot be interpreted, as individual matrices +# represent deviations from the mean, which is set to 0. ############################################################################### # What kind of connectivity is most powerful for classification? # -------------------------------------------------------------- -# *ConnectivityMeasure* can output the estimated subjects coefficients -# as a 1D arrays through the parameter *vectorize*. -connectivity_biomarkers = {} -kinds = ['correlation', 'partial correlation', 'tangent'] -for kind in kinds: - conn_measure = ConnectivityMeasure(kind=kind, vectorize=True) - connectivity_biomarkers[kind] = conn_measure.fit_transform(pooled_subjects) - -# For each kind, all individual coefficients are stacked in a unique 2D matrix. -print('{0} correlation biomarkers for each subject.'.format( - connectivity_biomarkers['correlation'].shape[1])) - -############################################################################### -# Note that we use the **pooled groups**. This is crucial for **tangent** kind, -# to get the displacements from a **unique** `mean_` of all subjects. - -############################################################################### -# We stratify the dataset into homogeneous classes according to phenotypic -# and scan site. We then split the subjects into 30 folds with the same -# proportion of each class as in the whole cohort for cross-validation +# We will use connectivity matrices as features to distinguish children from +# adults. We use cross-validation and measure classification accuracy to +# compare the different kinds of connectivity matrices. +# We use random splits of the subjects into training/testing sets. +# StratifiedShuffleSplit allows preserving the proportion of children in the +# test set. +from sklearn.svm import LinearSVC from sklearn.model_selection import StratifiedShuffleSplit +from sklearn.metrics import accuracy_score +import numpy as np +kinds = ['correlation', 'partial correlation', 'tangent'] _, classes = np.unique(groups, return_inverse=True) -cv = StratifiedShuffleSplit(n_splits=30) -############################################################################### -# and use the connectivity coefficients to classify children vs adults. +cv = StratifiedShuffleSplit(n_splits=15, random_state=0, test_size=5) +pooled_subjects = np.asarray(pooled_subjects) -# Note that in cv.split(X, y), -# providing y is sufficient to generate the splits and -# hence np.zeros(n_samples) may be used as a placeholder for X -# instead of actual training data. -from sklearn.svm import LinearSVC -from sklearn.model_selection import cross_val_score - -mean_scores = [] +scores = {} for kind in kinds: - svc = LinearSVC(random_state=0) - cv_scores = cross_val_score(svc, - connectivity_biomarkers[kind], - y=classes, - cv=cv, - groups=groups, - scoring='accuracy', - ) - mean_scores.append(cv_scores.mean()) - -############################################################################### -# Finally, we can display the classification scores. - -############################################################################### -# Finally, we can display the classification scores. -from nilearn.plotting import show + scores[kind] = [] + for train, test in cv.split(pooled_subjects, classes): + # *ConnectivityMeasure* can output the estimated subjects coefficients + # as a 1D arrays through the parameter *vectorize*. + connectivity = ConnectivityMeasure(kind=kind, vectorize=True) + # build vectorized connectomes for subjects in the train set + connectomes = connectivity.fit_transform(pooled_subjects[train]) + # fit the classifier + classifier = LinearSVC().fit(connectomes, classes[train]) + # make predictions for the left-out test subjects + predictions = classifier.predict( + connectivity.transform(pooled_subjects[test])) + # store the accuracy for this cross-validation fold + scores[kind].append(accuracy_score(classes[test], predictions)) + + +###################################################################### +# display the results + +mean_scores = [np.mean(scores[kind]) for kind in kinds] +scores_std = [np.std(scores[kind]) for kind in kinds] plt.figure(figsize=(6, 4)) positions = np.arange(len(kinds)) * .1 + .1 -plt.barh(positions, mean_scores, align='center', height=.05) -yticks = [kind.replace(' ', '\n') for kind in kinds] +plt.barh(positions, mean_scores, align='center', height=.05, xerr=scores_std) +yticks = [k.replace(' ', '\n') for k in kinds] plt.yticks(positions, yticks) -plt.xlabel('Classification accuracy') -plt.grid(True) +plt.gca().grid(True) +plt.gca().set_axisbelow(True) +plt.gca().axvline(.8, color='red', linestyle='--') +plt.xlabel('Classification accuracy\n(red line = chance level)') plt.tight_layout() + ############################################################################### -# While the comparison is not fully conclusive on this small dataset, +# This is a small example to showcase nilearn features. In practice such +# comparisons need to be performed on much larger cohorts and several +# datasets. # `Dadi et al 2019 # `_ # Showed that across many cohorts and clinical questions, the tangent # kind should be preferred. -show() +plotting.show() diff --git a/examples/03_connectivity/plot_inverse_covariance_connectome.py b/examples/03_connectivity/plot_inverse_covariance_connectome.py index 5ee1cef823..88c430659b 100644 --- a/examples/03_connectivity/plot_inverse_covariance_connectome.py +++ b/examples/03_connectivity/plot_inverse_covariance_connectome.py @@ -51,9 +51,13 @@ ############################################################################## # Compute the sparse inverse covariance # -------------------------------------- -from sklearn.covariance import GraphLassoCV -estimator = GraphLassoCV() +try: + from sklearn.covariance import GraphicalLassoCV +except ImportError: + # for Scitkit-Learn < v0.20.0 + from sklearn.covariance import GraphLassoCV as GraphicalLassoCV +estimator = GraphicalLassoCV() estimator.fit(time_series) ############################################################################## @@ -103,11 +107,12 @@ view = plotting.view_connectome(-estimator.precision_, coords) -# uncomment this to open the plot in a web browser: -# view.open_in_browser() - -############################################################################## # In a Jupyter notebook, if ``view`` is the output of a cell, it will # be displayed below the cell - view + +############################################################################## + +# uncomment this to open the plot in a web browser: +# view.open_in_browser() + diff --git a/examples/03_connectivity/plot_multi_subject_connectome.py b/examples/03_connectivity/plot_multi_subject_connectome.py index c7f45f0ce4..78dc2ce2b6 100644 --- a/examples/03_connectivity/plot_multi_subject_connectome.py +++ b/examples/03_connectivity/plot_multi_subject_connectome.py @@ -52,7 +52,7 @@ def plot_matrices(cov, prec, title, labels): from nilearn import input_data # A "memory" to avoid recomputation -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory mem = Memory('nilearn_cache') masker = input_data.NiftiMapsMasker( @@ -84,8 +84,13 @@ def plot_matrices(cov, prec, title, labels): gsc = GroupSparseCovarianceCV(verbose=2) gsc.fit(subject_time_series) -from sklearn import covariance -gl = covariance.GraphLassoCV(verbose=2) +try: + from sklearn.covariance import GraphicalLassoCV +except ImportError: + # for Scitkit-Learn < v0.20.0 + from sklearn.covariance import GraphLassoCV as GraphicalLassoCV + +gl = GraphicalLassoCV(verbose=2) gl.fit(np.concatenate(subject_time_series)) @@ -102,10 +107,10 @@ def plot_matrices(cov, prec, title, labels): display_mode="lzr") plotting.plot_connectome(-gl.precision_, atlas_region_coords, edge_threshold='90%', - title="Sparse inverse covariance (GraphLasso)", + title="Sparse inverse covariance (GraphicalLasso)", display_mode="lzr", edge_vmax=.5, edge_vmin=-.5) -plot_matrices(gl.covariance_, gl.precision_, "GraphLasso", labels) +plot_matrices(gl.covariance_, gl.precision_, "GraphicalLasso", labels) title = "GroupSparseCovariance" plotting.plot_connectome(-gsc.precisions_[..., 0], diff --git a/examples/03_connectivity/plot_probabilistic_atlas_extraction.py b/examples/03_connectivity/plot_probabilistic_atlas_extraction.py index 938cd97ca1..21fb2153b6 100644 --- a/examples/03_connectivity/plot_probabilistic_atlas_extraction.py +++ b/examples/03_connectivity/plot_probabilistic_atlas_extraction.py @@ -88,11 +88,12 @@ view = plotting.view_connectome(correlation_matrix, coords, threshold='80%') -# uncomment this to open the plot in a web browser: -# view.open_in_browser() - -############################################################################## # In a Jupyter notebook, if ``view`` is the output of a cell, it will # be displayed below the cell - view + +############################################################################## + +# uncomment this to open the plot in a web browser: +# view.open_in_browser() + diff --git a/examples/03_connectivity/plot_simulated_connectome.py b/examples/03_connectivity/plot_simulated_connectome.py index 385676c08d..3df491300c 100644 --- a/examples/03_connectivity/plot_simulated_connectome.py +++ b/examples/03_connectivity/plot_simulated_connectome.py @@ -49,8 +49,13 @@ # Fit one graph lasso per subject -from sklearn.covariance import GraphLassoCV -gl = GraphLassoCV(verbose=1) +try: + from sklearn.covariance import GraphicalLassoCV +except ImportError: + # for Scitkit-Learn < v0.20.0 + from sklearn.covariance import GraphLassoCV as GraphicalLassoCV + +gl = GraphicalLassoCV(verbose=1) for n, subject in enumerate(subjects[:n_displayed]): gl.fit(subject) diff --git a/examples/03_connectivity/plot_sphere_based_connectome.py b/examples/03_connectivity/plot_sphere_based_connectome.py index 4ea44844e9..4c5bd58440 100644 --- a/examples/03_connectivity/plot_sphere_based_connectome.py +++ b/examples/03_connectivity/plot_sphere_based_connectome.py @@ -143,16 +143,15 @@ view = plotting.view_connectome(partial_correlation_matrix, dmn_coords) -# uncomment this to open the plot in a web browser: -# view.open_in_browser() - - -############################################################################## # In a Jupyter notebook, if ``view`` is the output of a cell, it will # be displayed below the cell - view +############################################################################## + +# uncomment this to open the plot in a web browser: +# view.open_in_browser() + ########################################################################## # Extract signals on spheres from an atlas @@ -211,13 +210,17 @@ ############################################################################### # in which situation the graphical lasso **sparse inverse covariance** # estimator captures well the covariance **structure**. -from sklearn.covariance import GraphLassoCV +try: + from sklearn.covariance import GraphicalLassoCV +except ImportError: + # for Scitkit-Learn < v0.20.0 + from sklearn.covariance import GraphLassoCV as GraphicalLassoCV -covariance_estimator = GraphLassoCV(cv=3, verbose=1) +covariance_estimator = GraphicalLassoCV(cv=3, verbose=1) ############################################################################### -# We just fit our regions signals into the `GraphLassoCV` object +# We just fit our regions signals into the `GraphicalLassoCV` object covariance_estimator.fit(timeseries) @@ -271,7 +274,7 @@ timeseries = spheres_masker.fit_transform(func_filename, confounds=confounds_filename) -covariance_estimator = GraphLassoCV() +covariance_estimator = GraphicalLassoCV() covariance_estimator.fit(timeseries) matrix = covariance_estimator.covariance_ @@ -321,7 +324,7 @@ timeseries = spheres_masker.fit_transform(func_filename, confounds=confounds_filename) -covariance_estimator = GraphLassoCV() +covariance_estimator = GraphicalLassoCV() covariance_estimator.fit(timeseries) matrix = covariance_estimator.covariance_ @@ -340,8 +343,6 @@ ############################################################################### # .. seealso:: # -# :ref:`sphx_glr_auto_examples_03_connectivity_plot_atlas_comparison.py` -# -# .. seealso:: +# * :ref:`sphx_glr_auto_examples_03_connectivity_plot_atlas_comparison.py` # -# :ref:`sphx_glr_auto_examples_03_connectivity_plot_multi_subject_connectome.py` +# * :ref:`sphx_glr_auto_examples_03_connectivity_plot_multi_subject_connectome.py` diff --git a/examples/04_manipulating_images/plot_extract_rois_statistical_maps.py b/examples/04_manipulating_images/plot_extract_rois_statistical_maps.py index 72773ff068..d63f7518c6 100644 --- a/examples/04_manipulating_images/plot_extract_rois_statistical_maps.py +++ b/examples/04_manipulating_images/plot_extract_rois_statistical_maps.py @@ -28,12 +28,12 @@ # Two types of strategies can be used from this threshold function # Type 1: strategy used will be based on scoreatpercentile -threshold_percentile_img = threshold_img(tmap_filename, threshold='97%') +threshold_percentile_img = threshold_img(tmap_filename, threshold='97%', copy=False) # Type 2: threshold strategy used will be based on image intensity # Here, threshold value should be within the limits i.e. less than max value. -threshold_value_img = threshold_img(tmap_filename, threshold=3.0) +threshold_value_img = threshold_img(tmap_filename, threshold=3.0, copy=False) ################################################################################ # Visualization diff --git a/examples/04_manipulating_images/plot_mask_computation.py b/examples/04_manipulating_images/plot_mask_computation.py index d6b76db8e2..470a2506c4 100644 --- a/examples/04_manipulating_images/plot_mask_computation.py +++ b/examples/04_manipulating_images/plot_mask_computation.py @@ -17,7 +17,6 @@ """ - from nilearn.input_data import NiftiMasker import nilearn.image as image from nilearn.plotting import plot_roi, plot_epi, show @@ -48,10 +47,15 @@ masker = NiftiMasker() masker.fit(miyawaki_filename) -# Plot the generated mask +# Plot the generated mask using the mask_img_ attribute plot_roi(masker.mask_img_, miyawaki_mean_img, title="Mask from already masked data") +############################################################################### +# Plot the generated mask using the .generate_report method +report = masker.generate_report() +report + ############################################################################### # Computing a mask from raw EPI data @@ -77,7 +81,8 @@ # We need to specify an 'epi' mask_strategy, as this is raw EPI data masker = NiftiMasker(mask_strategy='epi') masker.fit(epi_img) -plot_roi(masker.mask_img_, mean_img, title='EPI automatic mask') +report = masker.generate_report() +report ############################################################################### # Generate mask with strong opening @@ -90,7 +95,8 @@ # skull parts in the image. masker = NiftiMasker(mask_strategy='epi', mask_args=dict(opening=10)) masker.fit(epi_img) -plot_roi(masker.mask_img_, mean_img, title='EPI Mask with strong opening') +report = masker.generate_report() +report ############################################################################### # Generate mask with a high lower cutoff @@ -107,8 +113,8 @@ mask_args=dict(upper_cutoff=.9, lower_cutoff=.8, opening=False)) masker.fit(epi_img) -plot_roi(masker.mask_img_, mean_img, - title='EPI Mask: high lower_cutoff') +report = masker.generate_report() +report ############################################################################### # Computing the mask from the MNI template @@ -119,9 +125,27 @@ masker = NiftiMasker(mask_strategy='template') masker.fit(epi_img) -plot_roi(masker.mask_img_, mean_img, - title='Mask from template') +report = masker.generate_report() +report + +############################################################################### +# Compute and resample a mask +############################################################################### +# +# NiftiMasker also allows passing parameters directly to `image.resample_img`. +# We can specify a `target_affine`, a `target_shape`, or both. +# For more information on these arguments, +# see :doc:`plot_affine_transformation`. +# +# The NiftiMasker report allows us to see the mask before and after resampling. +# Simply hover over the report to see the mask from the original image. + +import numpy as np +masker = NiftiMasker(mask_strategy='epi', target_affine=np.eye(3) * 8) +masker.fit(epi_img) +report = masker.generate_report() +report ############################################################################### # After mask computation: extracting time series @@ -136,7 +160,6 @@ detrended_data = detrended.fit_transform(epi_img) # The timeseries are numpy arrays, so we can manipulate them with numpy -import numpy as np print("Trended: mean %.2f, std %.2f" % (np.mean(trended_data), np.std(trended_data))) diff --git a/examples/04_manipulating_images/plot_nifti_simple.py b/examples/04_manipulating_images/plot_nifti_simple.py index 6f3045f4c9..b24122490c 100644 --- a/examples/04_manipulating_images/plot_nifti_simple.py +++ b/examples/04_manipulating_images/plot_nifti_simple.py @@ -10,7 +10,7 @@ # Retrieve the brain development functional dataset from nilearn import datasets -dataset = datasets.fetch_haxby() +dataset = datasets.fetch_development_fmri(n_subjects=1) func_filename = dataset.func[0] # print basic information on the dataset @@ -30,7 +30,7 @@ mask_img = nifti_masker.mask_img_ ########################################################################### -# Visualize the mask +# Visualize the mask using the plot_roi method from nilearn.plotting import plot_roi from nilearn.image.image import mean_img @@ -39,6 +39,13 @@ plot_roi(mask_img, mean_func_img, display_mode='y', cut_coords=4, title="Mask") +########################################################################### +# Visualize the mask using the 'generate_report' method +# This report can be displayed in a Jupyter Notebook, +# opened in-browser using the .open_in_browser() method, +# or saved to a file using the .save_as_html(output_filepath) method. +report = nifti_masker.generate_report() +report ########################################################################### # Preprocess data with the NiftiMasker @@ -60,6 +67,10 @@ # Visualize results from nilearn.plotting import plot_stat_map, show from nilearn.image import index_img +from nilearn.image.image import mean_img + +# calculate mean image for the background +mean_func_img = mean_img(func_filename) plot_stat_map(index_img(components, 0), mean_func_img, display_mode='y', cut_coords=4, title="Component 0") diff --git a/examples/05_advanced/plot_age_group_prediction_cross_val.py b/examples/05_advanced/plot_age_group_prediction_cross_val.py new file mode 100644 index 0000000000..8a4f193efe --- /dev/null +++ b/examples/05_advanced/plot_age_group_prediction_cross_val.py @@ -0,0 +1,105 @@ +""" +Functional connectivity predicts age group +========================================== + +This example compares different kinds of functional connectivity between +regions of interest : correlation, partial correlation, and tangent space +embedding. + +The resulting connectivity coefficients can be used to +discriminate children from adults. In general, the tangent space embedding +**outperforms** the standard correlations: see `Dadi et al 2019 +`_ +for a careful study. +""" + +############################################################################### +# Load brain development fMRI dataset and MSDL atlas +# ------------------------------------------------------------------- +# We study only 60 subjects from the dataset, to save computation time. +from nilearn import datasets + +development_dataset = datasets.fetch_development_fmri(n_subjects=60) + +############################################################################### +# We use probabilistic regions of interest (ROIs) from the MSDL atlas. +from nilearn.input_data import NiftiMapsMasker + +msdl_data = datasets.fetch_atlas_msdl() +msdl_coords = msdl_data.region_coords + +masker = NiftiMapsMasker( + msdl_data.maps, resampling_target="data", t_r=2, detrend=True, + low_pass=.1, high_pass=.01, memory='nilearn_cache', memory_level=1).fit() +masked_data = [masker.transform(func, confounds) for + (func, confounds) in zip( + development_dataset.func, development_dataset.confounds)] + +############################################################################### +# What kind of connectivity is most powerful for classification? +# -------------------------------------------------------------- +# we will use connectivity matrices as features to distinguish children from +# adults. We use cross-validation and measure classification accuracy to +# compare the different kinds of connectivity matrices. + +# prepare the classification pipeline +from sklearn.pipeline import Pipeline +from nilearn.connectome import ConnectivityMeasure +from sklearn.svm import LinearSVC +from sklearn.dummy import DummyClassifier +from sklearn.model_selection import GridSearchCV + +kinds = ['correlation', 'partial correlation', 'tangent'] + +pipe = Pipeline( + [('connectivity', ConnectivityMeasure(vectorize=True)), + ('classifier', GridSearchCV(LinearSVC(), {'C': [.1, 1., 10.]}, cv=5))]) + +param_grid = [ + {'classifier': [DummyClassifier('most_frequent')]}, + {'connectivity__kind': kinds} +] + +###################################################################### +# We use random splits of the subjects into training/testing sets. +# StratifiedShuffleSplit allows preserving the proportion of children in the +# test set. +from sklearn.model_selection import GridSearchCV, StratifiedShuffleSplit +from sklearn.preprocessing import LabelEncoder + +groups = [pheno['Child_Adult'] for pheno in development_dataset.phenotypic] +classes = LabelEncoder().fit_transform(groups) + +cv = StratifiedShuffleSplit(n_splits=30, random_state=0, test_size=10) +gs = GridSearchCV(pipe, param_grid, scoring='accuracy', cv=cv, verbose=1, + refit=False, n_jobs=8) +gs.fit(masked_data, classes) +mean_scores = gs.cv_results_['mean_test_score'] +scores_std = gs.cv_results_['std_test_score'] + +###################################################################### +# display the results +from matplotlib import pyplot as plt + +plt.figure(figsize=(6, 4)) +positions = [.1, .2, .3, .4] +plt.barh(positions, mean_scores, align='center', height=.05, xerr=scores_std) +yticks = ['dummy'] + list(gs.cv_results_['param_connectivity__kind'].data[1:]) +yticks = [t.replace(' ', '\n') for t in yticks] +plt.yticks(positions, yticks) +plt.xlabel('Classification accuracy') +plt.gca().grid(True) +plt.gca().set_axisbelow(True) +plt.tight_layout() + + +############################################################################### +# This is a small example to showcase nilearn features. In practice such +# comparisons need to be performed on much larger cohorts and several +# datasets. +# `Dadi et al 2019 +# `_ +# Showed that across many cohorts and clinical questions, the tangent +# kind should be preferred. + +plt.show() diff --git a/examples/05_advanced/plot_localizer_mass_univariate_methods.py b/examples/05_advanced/plot_localizer_mass_univariate_methods.py index 9c8f4d5e2a..12531abf6c 100644 --- a/examples/05_advanced/plot_localizer_mass_univariate_methods.py +++ b/examples/05_advanced/plot_localizer_mass_univariate_methods.py @@ -35,7 +35,7 @@ tested_var = localizer_dataset.ext_vars['pseudo'] # Quality check / Remove subjects with bad tested variate -mask_quality_check = np.where(tested_var != b'None')[0] +mask_quality_check = np.where(tested_var != b'n/a')[0] n_samples = mask_quality_check.size contrast_map_filenames = [localizer_dataset.cmaps[i] for i in mask_quality_check] diff --git a/nilearn/__init__.py b/nilearn/__init__.py index 7bfee2f735..5d39246d7b 100644 --- a/nilearn/__init__.py +++ b/nilearn/__init__.py @@ -35,11 +35,17 @@ import gzip import sys import warnings +import os from distutils.version import LooseVersion from .version import _check_module_dependencies, __version__ +# Workaround issue discovered in intel-openmp 2019.5: +# https://github.com/ContinuumIO/anaconda-issues/issues/11294 +# +# see also https://github.com/scikit-learn/scikit-learn/pull/15020 +os.environ.setdefault("KMP_INIT_AT_FORK", "FALSE") def _py2_deprecation_warning(): py2_warning = ('Python2 support is deprecated and will be removed in ' diff --git a/nilearn/_utils/cache_mixin.py b/nilearn/_utils/cache_mixin.py index 30bde14440..3f82def65f 100644 --- a/nilearn/_utils/cache_mixin.py +++ b/nilearn/_utils/cache_mixin.py @@ -13,16 +13,10 @@ import nibabel import sklearn -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory MEMORY_CLASSES = (Memory, ) -try: - from joblib import Memory as JoblibMemory - MEMORY_CLASSES = (Memory, JoblibMemory) -except ImportError: - pass - import nilearn from .compat import _basestring diff --git a/nilearn/_utils/compat.py b/nilearn/_utils/compat.py index f76de77cae..27b648fdae 100644 --- a/nilearn/_utils/compat.py +++ b/nilearn/_utils/compat.py @@ -7,6 +7,7 @@ from distutils.version import LooseVersion import nibabel +import sklearn if sys.version_info[0] == 3: @@ -66,3 +67,15 @@ def md5_hash(string): m = hashlib.md5() m.update(string) return m.hexdigest() + + +if sklearn.__version__ < '0.21': + from sklearn.externals import joblib +else: + import joblib + +Memory = joblib.Memory +Parallel = joblib.Parallel +hash = joblib.hash +delayed = joblib.delayed +cpu_count = joblib.cpu_count diff --git a/nilearn/_utils/niimg_conversions.py b/nilearn/_utils/niimg_conversions.py index efdfad485c..3ecf93a159 100644 --- a/nilearn/_utils/niimg_conversions.py +++ b/nilearn/_utils/niimg_conversions.py @@ -10,7 +10,7 @@ import nilearn as ni import numpy as np import itertools -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from .cache_mixin import cache from .niimg import _safe_get_data, load_niimg diff --git a/nilearn/conftest.py b/nilearn/conftest.py new file mode 100644 index 0000000000..7d2d5abfe6 --- /dev/null +++ b/nilearn/conftest.py @@ -0,0 +1,30 @@ +from distutils.version import LooseVersion + +import numpy as np +import pytest + +from _pytest.doctest import DoctestItem + +try: + import matplotlib +except ImportError: + collect_ignore = ['plotting'] +else: + matplotlib # Prevents flake8 erring due to unused entities. + + +def pytest_collection_modifyitems(items): + + # numpy changed the str/repr formatting of numpy arrays in 1.14. We want to + # run doctests only for numpy >= 1.14.Adapted from scikit-learn + if LooseVersion(np.__version__) < LooseVersion('1.14'): + reason = 'doctests are only run for numpy >= 1.14' + skip_doctests = True + else: + skip_doctests = False + + if skip_doctests: + skip_marker = pytest.mark.skip(reason=reason) + for item in items: + if isinstance(item, DoctestItem): + item.add_marker(skip_marker) diff --git a/nilearn/connectome/connectivity_matrices.py b/nilearn/connectome/connectivity_matrices.py index fce8fd064a..e2988d0632 100644 --- a/nilearn/connectome/connectivity_matrices.py +++ b/nilearn/connectome/connectivity_matrices.py @@ -486,7 +486,7 @@ def _fit_transform(self, X, do_transform=False, do_fit=False): # Compute all the matrices, stored in "connectivities" if self.kind == 'correlation': covariances_std = [self.cov_estimator_.fit( - signal._standardize(x, detrend=False, normalize=True) + signal._standardize(x, detrend=False, standardize=True) ).covariance_ for x in X] connectivities = [cov_to_corr(cov) for cov in covariances_std] else: diff --git a/nilearn/connectome/group_sparse_cov.py b/nilearn/connectome/group_sparse_cov.py index f43076b992..06317097aa 100644 --- a/nilearn/connectome/group_sparse_cov.py +++ b/nilearn/connectome/group_sparse_cov.py @@ -15,7 +15,7 @@ from sklearn.base import BaseEstimator from sklearn.covariance import empirical_covariance -from sklearn.externals.joblib import Memory, delayed, Parallel +from nilearn._utils.compat import Memory, delayed, Parallel from sklearn.model_selection import check_cv from sklearn.utils.extmath import fast_logdet @@ -891,7 +891,7 @@ class GroupSparseCovarianceCV(BaseEstimator, CacheMixin): See also -------- GroupSparseCovariance, - sklearn.covariance.GraphLassoCV + sklearn.covariance.GraphicalLassoCV Notes ----- diff --git a/nilearn/datasets/atlas.py b/nilearn/datasets/atlas.py index 2be84139d8..3897f95110 100644 --- a/nilearn/datasets/atlas.py +++ b/nilearn/datasets/atlas.py @@ -1275,7 +1275,7 @@ def fetch_atlas_schaefer_2018(n_rois=400, yeo_networks=7, resolution_mm=1, ---------- n_rois: int number of regions of interest {100, 200, 300, 400 (default), 500, 600, - 800, 1000} + 700, 800, 900, 1000} yeo_networks: int ROI annotation according to yeo networks {7 (default), 17} @@ -1307,7 +1307,7 @@ def fetch_atlas_schaefer_2018(n_rois=400, yeo_networks=7, resolution_mm=1, References ---------- For more information on this dataset, see - https://github.com/ThomasYeoLab/CBIG/tree/v0.8.1-Schaefer2018_LocalGlobal/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal + https://github.com/ThomasYeoLab/CBIG/tree/v0.14.3-Update_Yeo2011_Schaefer2018_labelname/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations Schaefer A, Kong R, Gordon EM, Laumann TO, Zuo XN, Holmes AJ, Eickhoff SB, Yeo BTT. Local-Global parcellation of the human @@ -1320,8 +1320,15 @@ def fetch_atlas_schaefer_2018(n_rois=400, yeo_networks=7, resolution_mm=1, intrinsic functional connectivity. J Neurophysiol 106(3):1125-65, 2011. Licence: MIT. + + Notes + ----- + Release v0.14.3 of the Schaefer 2018 parcellation is used by + default. Versions prior to v0.14.3 are known to contain erroneous region + label names. For more details, see + https://github.com/ThomasYeoLab/CBIG/blob/master/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/Updates/Update_20190916_README.md """ - valid_n_rois = [100, 200, 300, 400, 500, 600, 800, 1000] + valid_n_rois = list(range(100, 1100, 100)) valid_yeo_networks = [7, 17] valid_resolution_mm = [1, 2] if n_rois not in valid_n_rois: @@ -1338,9 +1345,9 @@ def fetch_atlas_schaefer_2018(n_rois=400, yeo_networks=7, resolution_mm=1, if base_url is None: base_url = ('https://raw.githubusercontent.com/ThomasYeoLab/CBIG/' - 'v0.8.1-Schaefer2018_LocalGlobal/stable_projects/' - 'brain_parcellation/Schaefer2018_LocalGlobal/' - 'Parcellations/MNI/' + 'v0.14.3-Update_Yeo2011_Schaefer2018_labelname/' + 'stable_projects/brain_parcellation/' + 'Schaefer2018_LocalGlobal/Parcellations/MNI/' ) files = [] diff --git a/nilearn/datasets/func.py b/nilearn/datasets/func.py index 64281abfdd..38844a93b1 100644 --- a/nilearn/datasets/func.py +++ b/nilearn/datasets/func.py @@ -13,7 +13,7 @@ from sklearn.utils import deprecated from .utils import (_get_dataset_dir, _fetch_files, _get_dataset_descr, - _read_md5_sum_file, _tree, _filter_columns) + _read_md5_sum_file, _tree, _filter_columns, _fetch_file) from .._utils import check_niimg from .._utils.compat import BytesIO, _basestring, _urllib from .._utils.numpy_conversions import csv_to_array @@ -824,7 +824,7 @@ def fetch_localizer_contrasts(contrasts, n_subjects=None, get_tmaps=False, if n_subjects is None: n_subjects = 94 # 94 subjects available if (isinstance(n_subjects, numbers.Number) and - ((n_subjects > 94) or (n_subjects < 1))): + ((n_subjects > 94) or (n_subjects < 1))): warnings.warn("Wrong value for \'n_subjects\' (%d). The maximum " "value will be used instead (\'n_subjects=94\')") n_subjects = 94 # 94 subjects available @@ -886,6 +886,7 @@ def fetch_localizer_contrasts(contrasts, n_subjects=None, get_tmaps=False, "button press vs calculation and sentence listening/reading": "auditory&visual motor vs cognitive processing"} allowed_contrasts = list(contrast_name_wrapper.values()) + # convert contrast names contrasts_wrapped = [] # get a unique ID for each contrast. It is used to give a unique name to @@ -893,21 +894,27 @@ def fetch_localizer_contrasts(contrasts, n_subjects=None, get_tmaps=False, contrasts_indices = [] for contrast in contrasts: if contrast in allowed_contrasts: - contrasts_wrapped.append(contrast) + contrasts_wrapped.append(contrast.title().replace(" ", "")) contrasts_indices.append(allowed_contrasts.index(contrast)) elif contrast in contrast_name_wrapper: name = contrast_name_wrapper[contrast] - contrasts_wrapped.append(name) + contrasts_wrapped.append(name.title().replace(" ", "")) contrasts_indices.append(allowed_contrasts.index(name)) else: raise ValueError("Contrast \'%s\' is not available" % contrast) - # It is better to perform several small requests than a big one because: - # - Brainomics server has no cache (can lead to timeout while the archive - # is generated on the remote server) - # - Local (cached) version of the files can be checked for each contrast - opts = {'uncompress': True} + # Get the dataset OSF index + dataset_name = "brainomics_localizer" + index_url = "https://osf.io/hwbm2/download" + data_dir = _get_dataset_dir(dataset_name, data_dir=data_dir, + verbose=verbose) + index_file = _fetch_file(index_url, data_dir, verbose=verbose) + with open(index_file, "rt") as of: + index = json.load(of) + # Build data URLs that will be fetched + files = {} + root_url = "https://osf.io/download/{0}" if isinstance(n_subjects, numbers.Number): subject_mask = np.arange(1, n_subjects + 1) subject_id_max = "S%02d" % n_subjects @@ -916,26 +923,18 @@ def fetch_localizer_contrasts(contrasts, n_subjects=None, get_tmaps=False, subject_id_max = "S%02d" % np.max(n_subjects) n_subjects = len(n_subjects) subject_ids = ["S%02d" % s for s in subject_mask] - data_types = ["c map"] + data_types = ["cmaps"] if get_tmaps: - data_types.append("t map") - rql_types = str.join(", ", ["\"%s\"" % x for x in data_types]) - root_url = "http://brainomics.cea.fr/localizer/" - - base_query = ("Any X,XT,XL,XI,XF,XD WHERE X is Scan, X type XT, " - "X concerns S, " - "X label XL, X identifier XI, " - "X format XF, X description XD, " - 'S identifier <= "%s", ' % (subject_id_max, ) + - 'X type IN(%(types)s), X label "%(label)s"') - - urls = ["%sbrainomics_data_%d.zip?rql=%s&vid=data-zip" - % (root_url, i, - _urllib.parse.quote(base_query % {"types": rql_types, - "label": c}, - safe=',()')) - for c, i in zip(contrasts_wrapped, contrasts_indices)] + data_types.append("tmaps") filenames = [] + + def _is_valid_path(path, index, verbose): + if path not in index: + if verbose > 0: + print("Skiping path '{0}'...".format(path)) + return False + return True + for subject_id in subject_ids: for data_type in data_types: for contrast_id, contrast in enumerate(contrasts_wrapped): @@ -943,80 +942,87 @@ def fetch_localizer_contrasts(contrasts, n_subjects=None, get_tmaps=False, str.join('_', [data_type, contrast]), ' ', '_') file_path = os.path.join( "brainomics_data", subject_id, "%s.nii.gz" % name_aux) - file_tarball_url = urls[contrast_id] - filenames.append((file_path, file_tarball_url, opts)) + path = "/".join([ + "/localizer", "derivatives", "spm_1st_level", + "sub-%s" % subject_id, + "sub-%s_task-localizer_acq-%s_%s.nii.gz" % ( + subject_id, contrast, data_type)]) + if _is_valid_path(path, index, verbose=verbose): + file_url = root_url.format(index[path][1:]) + opts = {"move": file_path} + filenames.append((file_path, file_url, opts)) + files.setdefault(data_type, []).append(file_path) + # Fetch masks if asked by user if get_masks: - urls.append("%sbrainomics_data_masks.zip?rql=%s&vid=data-zip" - % (root_url, - _urllib.parse.quote(base_query % {"types": '"boolean mask"', - "label": "mask"}, - safe=',()'))) for subject_id in subject_ids: file_path = os.path.join( "brainomics_data", subject_id, "boolean_mask_mask.nii.gz") - file_tarball_url = urls[-1] - filenames.append((file_path, file_tarball_url, opts)) + path = "/".join([ + "/localizer", "derivatives", "spm_1st_level", + "sub-%s" % subject_id, "sub-%s_mask.nii.gz" % subject_id]) + if _is_valid_path(path, index, verbose=verbose): + file_url = root_url.format(index[path][1:]) + opts = {"move": file_path} + filenames.append((file_path, file_url, opts)) + files.setdefault("masks", []).append(file_path) + # Fetch anats if asked by user if get_anats: - urls.append("%sbrainomics_data_anats.zip?rql=%s&vid=data-zip" - % (root_url, - _urllib.parse.quote(base_query % {"types": '"normalized T1"', - "label": "anatomy"}, - safe=',()'))) for subject_id in subject_ids: file_path = os.path.join( "brainomics_data", subject_id, "normalized_T1_anat_defaced.nii.gz") - file_tarball_url = urls[-1] - filenames.append((file_path, file_tarball_url, opts)) - # Fetch subject characteristics (separated in two files) - if url is None: - url_csv = ("%sdataset/cubicwebexport.csv?rql=%s&vid=csvexport" - % (root_url, _urllib.parse.quote("Any X WHERE X is Subject"))) - url_csv2 = ("%sdataset/cubicwebexport2.csv?rql=%s&vid=csvexport" - % (root_url, - _urllib.parse.quote("Any X,XI,XD WHERE X is QuestionnaireRun, " - "X identifier XI, X datetime " - "XD", safe=',') - )) - else: - url_csv = "%s/cubicwebexport.csv" % url - url_csv2 = "%s/cubicwebexport2.csv" % url - filenames += [("cubicwebexport.csv", url_csv, {}), - ("cubicwebexport2.csv", url_csv2, {})] + path = "/".join([ + "/localizer", "derivatives", "spm_preprocessing", + "sub-%s" % subject_id, "sub-%s_T1w.nii.gz" % subject_id]) + if _is_valid_path(path, index, verbose=verbose): + file_url = root_url.format(index[path][1:]) + opts = {"move": file_path} + filenames.append((file_path, file_url, opts)) + files.setdefault("anats", []).append(file_path) + + # Fetch subject characteristics + participants_file = os.path.join("brainomics_data", "participants.tsv") + path = "/localizer/participants.tsv" + if _is_valid_path(path, index, verbose=verbose): + file_url = root_url.format(index[path][1:]) + opts = {"move": participants_file} + filenames.append((participants_file, file_url, opts)) + + # Fetch behavioural + behavioural_file = os.path.join( + "brainomics_data", "phenotype", "behavioural.tsv") + path = "/localizer/phenotype/behavioural.tsv" + if _is_valid_path(path, index, verbose=verbose): + file_url = root_url.format(index[path][1:]) + opts = {"move": behavioural_file} + filenames.append((behavioural_file, file_url, opts)) # Actual data fetching - dataset_name = 'brainomics_localizer' - data_dir = _get_dataset_dir(dataset_name, data_dir=data_dir, - verbose=verbose) fdescr = _get_dataset_descr(dataset_name) - files = _fetch_files(data_dir, filenames, verbose=verbose) - anats = None - masks = None - tmaps = None - # combine data from both covariates files into one single recarray + _fetch_files(data_dir, filenames, verbose=verbose) + for key, value in files.items(): + files[key] = [os.path.join(data_dir, val) for val in value] + + # Load covariates file from numpy.lib.recfunctions import join_by - ext_vars_file2 = files[-1] - csv_data2 = np.recfromcsv(ext_vars_file2, delimiter=';') - files = files[:-1] - ext_vars_file = files[-1] - csv_data = np.recfromcsv(ext_vars_file, delimiter=';') - files = files[:-1] - # join_by sorts the output along the key - csv_data = join_by('subject_id', csv_data, csv_data2, - usemask=False, asrecarray=True)[subject_mask - 1] - if get_anats: - anats = files[-n_subjects:] - files = files[:-n_subjects] - if get_masks: - masks = files[-n_subjects:] - files = files[:-n_subjects] - if get_tmaps: - tmaps = files[1::2] - files = files[::2] - return Bunch(cmaps=files, tmaps=tmaps, masks=masks, anats=anats, - ext_vars=csv_data, description=fdescr) + participants_file = os.path.join(data_dir, participants_file) + csv_data = np.recfromcsv(participants_file, delimiter='\t') + behavioural_file = os.path.join(data_dir, behavioural_file) + csv_data2 = np.recfromcsv(behavioural_file, delimiter='\t') + csv_data = join_by( + "participant_id", csv_data, csv_data2, usemask=False, asrecarray=True) + subject_names = csv_data["participant_id"].tolist() + subjects_indices = [] + for name in subject_ids: + name = name.encode("utf8") + if name not in subject_names: + continue + subjects_indices.append(subject_names.index(name)) + csv_data = csv_data[subjects_indices] + + return Bunch(ext_vars=csv_data, description=fdescr, **files) def fetch_localizer_calculation_task(n_subjects=1, data_dir=None, url=None, @@ -1064,20 +1070,20 @@ def fetch_localizer_calculation_task(n_subjects=1, data_dir=None, url=None, get_tmaps=False, get_masks=False, get_anats=False, data_dir=data_dir, url=url, resume=True, verbose=verbose) - data.pop('tmaps') - data.pop('masks') - data.pop('anats') return data -def fetch_localizer_button_task(data_dir=None, url=None, verbose=1): +def fetch_localizer_button_task(n_subjects=None, data_dir=None, url=None, + verbose=1): """Fetch left vs right button press contrast maps from the localizer. - This function ships only 2nd subject (S02) specific tmap and - its normalized T1 image. - Parameters ---------- + n_subjects: int, optional + The number of subjects to load. If None is given, + this function ships only 2nd subject (S02) specific tmap and + its normalized T1 image. + data_dir: string, optional Path of the data directory. Used to force data storage in a specified location. @@ -1093,6 +1099,7 @@ def fetch_localizer_button_task(data_dir=None, url=None, verbose=1): ------- data: Bunch Dictionary-like object, the interest attributes are : + 'cmaps': string list, giving paths to nifti contrast maps 'tmap': string, giving paths to nifti contrast maps 'anat': string, giving paths to normalized anatomical image @@ -1109,30 +1116,19 @@ def fetch_localizer_button_task(data_dir=None, url=None, verbose=1): nilearn.datasets.fetch_localizer_contrasts """ - # The URL can be retrieved from the nilearn account on OSF (Open - # Science Framework). Uploaded files specific to S02 from - # fetch_localizer_contrasts ['left vs right button press'] - if url is None: - url = 'https://osf.io/dx9jn/download' - - tmap = "t_map_left_auditory_&_visual_click_vs_right_auditory&visual_click.nii.gz" - anat = "normalized_T1_anat_defaced.nii.gz" - - opts = {'uncompress': True} - - options = ('tmap', 'anat') - filenames = [(os.path.join('localizer_button_task', name), url, opts) - for name in (tmap, anat)] - - dataset_name = 'brainomics' - data_dir = _get_dataset_dir(dataset_name, data_dir=data_dir, - verbose=verbose) - files = _fetch_files(data_dir, filenames, verbose=verbose) - - fdescr = _get_dataset_descr('brainomics_localizer') - - params = dict([('description', fdescr)] + list(zip(options, files))) - return Bunch(**params) + if n_subjects is None: + n_subjects = [2] + data = fetch_localizer_contrasts(["left vs right button press"], + n_subjects=n_subjects, + get_tmaps=True, get_masks=False, + get_anats=True, data_dir=data_dir, + url=url, resume=True, verbose=verbose) + # TODO: remove -> only here for compatibility + if len(data["tmaps"]) == 1: + setattr(data, "tmap", data["tmaps"][0]) + if len(data["anats"]) == 1: + setattr(data, "anat", data["anats"][0]) + return data def fetch_abide_pcp(data_dir=None, n_subjects=None, pipeline='cpac', @@ -1360,7 +1356,7 @@ def _load_mixed_gambles(zmap_imgs): def fetch_mixed_gambles(n_subjects=1, data_dir=None, url=None, resume=True, - return_raw_data=False, verbose=0): + return_raw_data=False, verbose=1): """Fetch Jimura "mixed gambles" dataset. Parameters @@ -1380,7 +1376,7 @@ def fetch_mixed_gambles(n_subjects=1, data_dir=None, url=None, resume=True, resume: bool, optional (default True) If true, try resuming download if possible. - verbose: int, optional (default 0) + verbose: int, optional (default 1) Defines the level of verbosity of the output. return_raw_data: bool, optional (default True) @@ -1808,7 +1804,7 @@ def fetch_surf_nki_enhanced(n_subjects=10, data_dir=None, 'A00056097', 'A00056098', 'A00056164', 'A00056372', 'A00056452', 'A00056489', 'A00056949'] - nitrc_ids = range(8260, 8470) + nitrc_ids = range(8260, 8464) max_subjects = len(ids) if n_subjects is None: n_subjects = max_subjects @@ -1816,7 +1812,6 @@ def fetch_surf_nki_enhanced(n_subjects=10, data_dir=None, warnings.warn('Warning: there are only %d subjects' % max_subjects) n_subjects = max_subjects ids = ids[:n_subjects] - nitrc_ids = nitrc_ids[:n_subjects] # Dataset description fdescr = _get_dataset_descr(dataset_name) @@ -1850,13 +1845,13 @@ def fetch_surf_nki_enhanced(n_subjects=10, data_dir=None, func = os.path.join('%s', '%s_%s_preprocessed_fwhm6.gii') rh = _fetch_files(data_dir, [(func % (ids[i], ids[i], 'right'), - archive % (nitrc_ids[i], ids[i], 'rh'), + archive % (nitrc_ids[2*i+1], ids[i], 'rh'), {'move': func % (ids[i], ids[i], 'right')} )], resume=resume, verbose=verbose) lh = _fetch_files(data_dir, [(func % (ids[i], ids[i], 'left'), - archive % (nitrc_ids[i], ids[i], 'lh'), + archive % (nitrc_ids[2*i], ids[i], 'lh'), {'move': func % (ids[i], ids[i], 'left')} )], resume=resume, verbose=verbose) @@ -1995,7 +1990,7 @@ def _fetch_development_fmri_functional(participants, data_dir, url, verbose): def fetch_development_fmri(n_subjects=None, reduce_confounds=True, - data_dir=None, resume=True, verbose=0): + data_dir=None, resume=True, verbose=1): """Fetch movie watching based brain development dataset (fMRI) The data is downsampled to 4mm resolution for convenience. The origin of @@ -2024,7 +2019,7 @@ def fetch_development_fmri(n_subjects=None, reduce_confounds=True, resume: bool, optional (default True) Whether to resume download of a partly-downloaded file. - verbose: int, optional (default 0) + verbose: int, optional (default 1) Defines the level of verbosity of the output. Returns diff --git a/nilearn/datasets/neurovault.py b/nilearn/datasets/neurovault.py index 0f51b319ac..7843ddcd3e 100644 --- a/nilearn/datasets/neurovault.py +++ b/nilearn/datasets/neurovault.py @@ -2629,8 +2629,6 @@ def fetch_neurovault_motor_task(data_dir=None, verbose=1): Notes ------ - This function is only a caller for the fetch_localizer_contrasts in order - to simplify examples reading and understanding. The 'left vs right button press' contrast is used: https://neurovault.org/images/10426/ @@ -2673,8 +2671,6 @@ def fetch_neurovault_auditory_computation_task(data_dir=None, verbose=1): Notes ------ - This function is only a caller for the fetch_localizer_contrasts in order - to simplify examples reading and understanding. The 'auditory_calculation_vs_baseline' contrast is used: https://neurovault.org/images/32980/ diff --git a/nilearn/datasets/tests/data/localizer_behavioural.tsv b/nilearn/datasets/tests/data/localizer_behavioural.tsv new file mode 100644 index 0000000000..d7c18f0a3c --- /dev/null +++ b/nilearn/datasets/tests/data/localizer_behavioural.tsv @@ -0,0 +1,95 @@ +participant_id nuage2 pente_dots_lin couleur nom_des_gens pb_phono lin_vs_log aspect pb_express facilite_addition espece_plante visu_vb_pour_calcul tv r2_dots_log ratio_pw_w pb_allocentrique pb_rotation details score_cal_complexe activites_pratiques_nb bruxe espece_animales mot pb_lecture moyenne_pw_w trajet score_3d nuage10 nuage11 nuage12 pb_ecriture gaucherie score_addition probleme_ecole facilite_soustraction pente_dots_log arc perspective score_multiplication r2_dots_lin pair1 pair3 pair2 pair5 pair4 itineraire_plan score_soustraction erreur_w imagerie type_pb_langage decomposition niveau_etude francais1erl geometrie coef_bisec pente_sujet_estim_lin pb_prononc seine parle_tard pb_a_l_ecole autoestimation_calcul lettre_miroir rapport_pente_lin_groupe comment nuage3 nuage1 nuage6 nuage7 nuage4 nuage5 strategie nuage8 nuage9 score_tableau_langage pb_binaire erreur_langage droitier erreur_ps_w pb_consonne facilite_multiplication dyslexie visage coef_estim_qt pb_nonlangage bilingue dessin_fini bus billet pente_sujet_estim_log autoevaluation_cx pb_reconnaissance difference_pw_w score_pb_g_d car synaesthete error difficult_apprend_lire pente_bisec orthophoniste lieux orientation normalized_pw autoevaluation_dessin bonne_reconnaissance lycee avion id difficulte_calc_localizer dessin_note_sur_20 rapport_pente_log_groupe score_imageur visuel_verbal algebre pain edimburgh arbre g_contrarie lecture_ok pb_en_3d pb_2eme_langue oiseau pb_egocentrique pseudo pente_estim_qt autoevaluation_rotation pb_orthogr +S01 35.0 0.416922 n/a n/a False -0.0952051 4.0 False 4.0 n/a 1.0 17.0 0.916693 1.875 False False 2.0 0.966667 n/a 500.0 n/a 8.0 False 11.5 9.0 0.916667 20.0 10.0 35.0 False 0.0 10.0 0.0 4.0 0.749906 40.0 2.0 10.0 0.821488 3.0 23.0 5.0 68.0 43.0 n/a 10.0 1.0 3.0 0 False 4.0 True 4.0 0.985224 0.642131 False 60.0 False False 3.0 False 0.620551 n/a 10.0 25.0 20.0 40.0 50.0 65.0 u 15.0 30.0 4.0 False 0.0 True 3.0 False 4.0 False 1.0 0.969218 False False 1.0 17.0 13.0 0.862849 4.0 0 7.0 0.0 53.0 0 n/a False 0.953448 False 2.0 4.0 0.304348 2.0 lieux 4.0 70.0 165 n/a 18.0 0.85468 9.51389 4.0 4.0 60.0 10.0 30.0 False True False False 2.4 False 15.0 0.988097 4.0 False +S02 30.0 0.529093 n/a n/a False 0.0151144 3.5 False 3.0 n/a 3.0 20.0 0.954898 1.77778 False False 1.0 0.933333 3.4 700.0 n/a 9.0 False 12.5 5.0 0.916667 30.0 10.0 40.0 False 0.0 10.0 0.0 4.0 0.76985 20.0 2.0 10.0 0.970012 3.0 29.0 4.0 65.0 43.0 n/a 8.0 0.0 3.0 0 True 3.0 True 3.0 0.999742 0.776734 False 50.0 False False 3.0 False 0.787507 n/a 15.0 25.0 20.0 50.0 55.0 70.0 n/a 20.0 60.0 2.5 False 0.0 True 2.0 False 5.0 False 1.0 0.90535 False False 1.0 8.0 10.0 0.873827 3.0 0 7.0 0.0 52.0 n/a n/a False 1.00269 False 1.0 3.0 0.28 1.0 0 3.0 20.0 174 n/a 15.0 0.87741 7.80556 8.0 4.0 90.0 10.0 80.0 False True False False 1.5 False 16.0 1.15221 3.0 False +S03 35.0 0.45857 n/a n/a False -0.0038151 2.0 False 2.0 n/a 3.0 10.0 0.894501 1.55556 False False 1.0 0.866667 3.6 40.0 0.0 9.0 False 11.5 10.0 0.5 30.0 10.0 40.0 False 0.25 10.0 0.0 3.0 0.715695 100.0 2.0 10.0 0.890686 3.0 33.0 5.0 63.0 42.0 n/a 9.0 0.0 2.0 0 False 4.0 True 3.0 0.995588 0.682245 False 30.0 False False 2.0 False 0.68254 n/a 15.0 30.0 15.0 30.0 50.0 70.0 d 20.0 50.0 4.0 False 0.0 True 0.0 False 4.0 False 2.0 0.658032 False False 1.0 12.0 10.0 0.816513 2.33333 animaux 5.0 0.0 60.0 0 n/a False 0.966338 False 2.0 4.0 0.217391 2.0 visages, lieux 4.0 100.0 204 n/a 12.0 0.815689 7.375 6.0 4.0 80.0 11.0 80.0 False False False False 2.5 False 14.0 0.740778 2.0 False +S04 20.0 0.240791 1.0 1.0 False 0.0366737 3.5 False 5.0 1.0 1.0 45.0 0.937822 1.58333 True True 2.0 0.766667 3.6 450.0 1.0 12.0 False 15.5 10.0 0.833333 15.0 10.0 25.0 False 0.333333 10.0 0.0 2.0 0.584904 70.0 2.0 9.0 0.974495 3.0 32.0 4.0 55.0 44.0 1.0 9.0 0.0 1.0 0 False 3.0 True 4.0 0.997322 0.356258 False 100.0 False False 3.0 False 0.358396 n/a 10.0 15.0 15.0 25.0 30.0 35.0 d 10.0 30.0 4.0 False 0.0 True 0.0 False 5.0 False 2.0 0.350432 False False 1.0 25.0 12.0 0.668016 4.0 LIEUX 7.0 2.0 50.0 0 n/a False 0.984509 False 0.0 2.0 0.225806 1.0 VISAGE 5.0 250.0 322 n/a 17.0 0.666625 5.52778 6.0 5.0 1.0 14.0 100.0 True True True False 3.5 False 19.0 0.791295 2.0 False +S05 40.0 0.3345 1.0 1.0 False -0.0530016 1.5 False 3.0 1.0 1.0 10.0 0.914142 1.77778 False True 0.0 0.433333 1.8 400.0 1.0 9.0 False 12.5 8.0 0.583333 20.0 10.0 30.0 False 0.0 9.0 0.0 2.0 0.635478 20.0 0.0 6.0 0.86114 3.0 23.0 3.0 60.0 40.0 1.0 4.0 0.0 3.0 0 True 2.0 True 0.0 0.991584 0.503873 False 50.0 False False 2.0 False 0.497873 n/a 15.0 30.0 20.0 30.0 45.0 50.0 n/a 15.0 40.0 2.0 False 0.0 True 4.0 False 3.0 False 1.0 0.917151 False False 1.0 10.0 10.0 0.724752 0.0 n/a 7.0 0.0 30.0 0 n/a False 1.01049 False 1.0 2.5 0.28 1.0 n/a 0.0 30.0 298 n/a 5.0 0.724264 6.40278 6.0 2.0 40.0 11.0 15.0 False True True True 1.0 False 16.0 1.02732 3.0 False +S06 30.0 0.52638 n/a n/a False -0.00565731 3.5 False 4.0 n/a 1.0 25.0 0.933403 2.0 False False 2.0 0.633333 3.6 400.0 n/a 9.0 False 13.5 8.0 0.75 20.0 10.0 50.0 False 0.0 10.0 2.0 3.0 0.834941 75.0 2.0 10.0 0.927745 3.0 34.0 4.0 64.0 43.0 n/a 8.0 0.0 3.0 0 False 2.0 True 5.0 0.998702 0.781213 False 20.0 True False 3.0 False 0.783469 n/a 10.0 20.0 20.0 50.0 50.0 70.0 u 20.0 50.0 2.0 True 0.0 True 5.0 False 5.0 False 2.0 0.881779 False False 1.0 15.0 10.0 0.951082 0.0 n/a 9.0 0.0 45.0 0 n/a True 1.01283 False 2.0 3.0 0.333333 1.0 LIEUX VISAGES 3.0 200.0 311 n/a 17.0 0.951596 8.0 4.0 4.0 75.0 10.0 75.0 False True False True 2.0 False 18.0 1.0508 n/a False +S07 60.0 0.887654 1.0 1.0 False -0.013893 2.0 False 3.0 1.0 1.0 10.0 0.923668 2.0 False True 1.0 0.7 3.8 300.0 1.0 11.0 True 16.5 7.0 0.666667 50.0 15.0 80.0 False 0.25 9.0 2.0 2.0 0.967964 10.0 0.0 10.0 0.909775 3.0 30.0 3.0 62.0 40.0 1.0 6.0 0.0 3.0 aprentissage lecture , difference d/t , p/b a 6ans duree 1ans False 4.0 True 5.0 0.994361 1.30039 False 50.0 False False 2.0 False 1.32119 n/a 10.0 40.0 30.0 100.0 80.0 100.0 d 30.0 100.0 2.0 True 0.0 True 6.0 False 3.0 False 1.0 0.884219 False False 1.0 4.0 10.0 1.09569 2.0 n/a 11.0 0.0 40.0 0 n/a True 1.03761 True 2.0 1.0 0.333333 1.0 LIEUX 4.0 30.0 333 n/a 8.0 1.1032 5.84722 6.0 5.0 40.0 10.0 30.0 False True True False 2.0 False 22.0 0.958523 1.0 False +S08 30.0 0.378301 n/a n/a False 0.0574613 3.0 False 4.0 n/a 2.0 5.0 0.914426 1.35714 False False 2.0 0.833333 7.0 350.0 n/a 14.0 False 16.5 64.0 0.416667 20.0 15.0 35.0 False 0.0 10.0 0.0 3.0 0.657123 80.0 2.0 10.0 0.971887 3.0 32.0 4.0 63.0 42.0 n/a 8.0 2.0 1.0 0 False 4.0 False 5.0 0.999458 0.551338 False 100.0 False False 3.0 True 0.563067 n/a 10.0 20.0 18.0 35.0 40.0 50.0 u 15.0 50.0 4.0 False 0.0 True 2.0 False 5.0 False 1.0 0.721875 False True 1.0 20.0 10.0 0.74894 4.0 LIEUX 5.0 0.0 30.0 0 n/a False 1.00225 False 0.0 1.5 0.151515 2.0 PHYSIONOMIE 4.0 100.0 290 n/a 16.0 0.748933 4.84722 8.0 4.0 90.0 10.0 80.0 False True False False 1.9 False 19.0 0.959285 3.0 False +S09 100.0 1.29591 n/a n/a False -0.0193175 4.0 False 3.0 n/a 1.0 12.0 0.943651 1.47826 False True 2.0 0.533333 2.9 800.0 n/a 11.5 False 14.25 10.0 0.5 80.0 15.0 100.0 False 0.2 10.0 0.0 2.0 1.03413 200.0 2.0 10.0 0.924333 3.0 35.0 3.0 55.0 42.0 n/a 6.0 0.0 3.0 0 False 3.0 True 2.0 0.988621 1.94941 False 50.0 False False 1.0 False 1.92885 n/a 20.0 50.0 35.0 110.0 130.0 160.0 u 25.0 120.0 3.0 False 0.0 True 2.0 False 4.0 False 1.0 0.85892 False False 1.0 15.0 8.0 1.18304 0.0 n/a 5.5 0.0 50.0 0 n/a False 1.03538 False 2.0 3.0 0.192982 1.0 LIEUX 2.0 300.0 336 n/a 18.0 1.17861 7.5 4.0 2.0 45.0 14.0 30.0 False True True False 1.5 False 17.0 1.22631 1.0 False +S10 43.0 0.534045 n/a n/a False 0.0017111 4.5 False 3.0 n/a 1.0 40.0 0.973282 1.66667 False True 2.0 0.6 4.2 500.0 0.0 9.0 True 12.0 10.0 0.583333 27.0 12.0 39.0 False 0.25 8.0 4.0 2.0 0.780877 50.0 2.0 10.0 0.974993 3.0 30.0 3.0 66.0 43.0 n/a 7.0 1.0 3.0 APPRENTISSAGE LECTURE/DYSLEXIE/BEGAIEMENT ZEZAIEMENT False 4.0 True 5.0 0.994773 0.792601 False 70.0 True False 2.0 False 0.794878 n/a 12.0 25.0 25.0 48.0 58.0 70.0 d 19.0 60.0 4.0 True 2.0 True 4.0 True 3.0 True 2.0 0.944997 False False 1.0 12.0 11.0 0.890339 2.33333 animaux 6.0 0.0 50.0 0 n/a True 1.05757 True 1.0 3.0 0.25 3.0 lieux 3.0 80.0 163 n/a 19.0 0.889978 8.06944 6.0 3.0 70.0 10.0 100.0 False True False False 3.0 False 15.0 0.999617 2.0 False +S11 50.0 0.501391 n/a n/a False -0.155042 3.5 False 4.0 n/a 1.0 25.0 0.877283 1.25 True True 2.0 0.466667 1.6 400.0 n/a 8.0 False 9.0 8.0 0.583333 30.0 10.0 40.0 False 0.0 10.0 0.0 2.0 0.786632 200.0 2.0 7.0 0.722241 3.0 30.0 5.0 70.0 41.0 n/a 6.0 0.0 3.0 MATHS False 2.0 True 1.0 0.994483 0.767568 False 80.0 False True 1.0 True 0.746275 n/a 16.0 38.0 20.0 75.0 55.0 70.0 d 16.0 40.0 2.0 False 3.0 True 1.0 False 4.0 False 2.0 0.918997 False True 1.0 15.0 11.0 0.901555 2.66667 0 2.0 3.0 46.0 Lettres, chiffres, sons, temps, en espace et en couleur n/a False 0.973921 False 2.0 n/a 0.111111 3.0 visages, lieux 1.0 90.0 176 n/a 17.0 0.896537 4.81944 6.0 1.0 80.0 16.0 80.0 False True n/a False 3.0 True 10.0 1.03446 2.0 False +S12 40.0 0.45318 n/a n/a False -0.0294667 0.5 False 4.0 n/a 2.0 5.0 0.923912 1.75 False True 1.0 0.633333 3.2 500.0 n/a 12.0 False 16.5 8.0 0.5 35.0 12.0 37.0 False 0.25 8.0 2.0 3.0 0.722995 20.0 1.0 7.0 0.894445 3.0 32.0 4.0 60.0 45.0 n/a 8.0 1.0 3.0 FRANCAIS ORTHOGRAPHE LECTURE False 3.0 True 3.0 0.999026 0.676939 False 100.0 False False 3.0 False 0.674518 n/a 12.0 30.0 25.0 35.0 50.0 70.0 u 15.0 50.0 2.0 True 0.0 True 4.0 False 3.0 False 1.0 0.883083 False False 1.0 8.0 15.0 0.822753 3.33333 0 9.0 0.0 56.0 n/a n/a True 1.00245 False 1.0 1.5 0.272727 2.0 0 4.0 40.0 182 n/a 7.0 0.824009 5.91667 6.0 4.0 50.0 11.0 80.0 True True True True 2.0 False 21.0 1.08707 2.0 True +S13 30.0 0.553522 1.0 1.0 False -0.0442015 3.5 False 3.0 1.0 1.0 12.0 0.962172 1.54545 False True 2.0 1.0 3.8 350.0 1.0 11.0 False 14.0 10.0 0.666667 25.0 10.0 50.0 False 0.2 10.0 0.0 4.0 0.840788 80.0 2.0 10.0 0.91797 3.0 33.0 4.0 70.0 44.0 1.0 10.0 0.0 3.0 0 False 3.0 True 4.0 0.999519 0.797884 False 75.0 False False 3.0 False 0.823867 n/a 12.0 30.0 20.0 59.0 55.0 60.0 d 20.0 70.0 2.0 False 0.0 True 2.0 False 5.0 False 1.0 0.96621 False False 1.0 10.0 15.0 0.94617 5.0 n/a 6.0 0.0 60.0 0 n/a False 1.02888 False 2.0 1.5 0.214286 1.0 LIEUX 5.0 100.0 318 n/a 17.0 0.958259 6.84722 4.0 5.0 85.0 12.0 80.0 False True False False 2.5 False 17.0 1.04223 2.0 False +S14 40.0 0.536215 n/a n/a False -0.0167022 1.5 False 4.0 n/a 1.0 7.0 0.982381 1.90909 False False 1.0 0.8 3.4 350.0 n/a 11.0 False 16.0 9.0 0.75 25.0 10.0 50.0 False 0.11 10.0 0.0 3.0 0.842689 50.0 1.0 10.0 0.965678 3.0 36.0 4.0 62.0 45.0 n/a 9.0 0.0 3.0 0 False 3.0 True 3.0 0.997089 0.788024 False 60.0 False False 3.0 False 0.798107 n/a 12.0 30.0 20.0 40.0 50.0 70.0 d 15.0 60.0 4.0 False 0.0 True 2.0 False 4.0 False 2.0 0.910639 False False 1.0 20.0 10.0 0.955723 3.33333 0 10.0 0.0 50.0 n/a n/a False 1.01764 False 2.0 2.5 0.3125 1.0 LIEUX VISAGES 4.0 100.0 219 n/a 9.0 0.960426 7.14583 5.0 3.0 60.0 10.0 30.0 False True True n/a 4.0 False 21.0 0.927176 2.0 False +S15 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a 366 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a +S16 55.0 0.432409 n/a n/a False -0.114653 2.0 False 3.0 n/a 1.0 40.0 0.930288 2.0 False False 1.0 0.633333 3.4 350.0 n/a 7.0 False 10.5 8.0 0.666667 30.0 10.0 55.0 False 0.0 9.0 0.0 2.0 0.735609 50.0 1.0 8.0 0.815635 3.0 30.0 4.0 67.0 43.0 n/a 6.0 0.0 3.0 0 False 4.0 True 3.0 0.99974 0.651471 False 100.0 False False 2.0 False 0.643601 n/a 15.0 35.0 25.0 45.0 50.0 60.0 d 20.0 50.0 4.0 False 0.0 True 3.0 False 3.0 False 2.0 0.896679 False False 1.0 15.0 15.0 0.835647 2.33333 0 7.0 2.0 50.0 n/a n/a False 1.01069 False 1.0 3.5 0.333333 2.0 physionomie 3.0 40.0 194 n/a 10.0 0.838385 7.74306 7.0 3.0 45.0 10.0 80.0 False True n/a False 2.0 True 14.0 0.951493 2.0 False +S17 50.0 1.90848 n/a n/a False 0.00262361 5.0 False 2.0 n/a 1.0 20.0 0.934938 2.0 True True 2.0 0.266667 1.8 200.0 n/a 11.0 False 16.5 8.0 0.416667 20.0 10.0 100.0 False 0.0 8.0 0.0 n/a 1.48161 30.0 2.0 7.0 0.937562 3.0 30.0 5.0 60.0 40.0 n/a 0.0 1.0 3.0 0 False 3.0 True 4.0 0.995747 2.7377 False 200.0 False False 2.0 False 2.8406 n/a 10.0 50.0 20.0 100.0 130.0 200.0 u 10.0 200.0 3.0 False 0.0 True 2.0 False 3.0 False 2.0 0.744411 False False 1.0 50.0 8.0 1.67618 2.0 0 11.0 2.0 57.0 0 n/a False 0.944038 False 1.0 3.0 0.333333 3.0 Visages 3.0 150.0 205 n/a 20.0 1.68861 8.18056 4.0 3.0 50.0 11.0 100.0 False True False False 2.0 False 22.0 0.940993 3.0 False +S18 40.0 2.15291 1.0 1.0 False -0.169848 3.5 False 3.0 1.0 1.0 10.0 0.890863 1.41667 False True 2.0 0.466667 3.0 300.0 1.0 12.0 False 14.5 9.0 0.583333 35.0 7.0 40.0 False 0.5 10.0 1.0 2.0 1.41522 20.0 2.0 10.0 0.721015 3.0 30.0 4.0 63.0 43.0 1.0 4.0 0.0 1.0 0 False 2.0 True 3.0 1.0 2.99655 False 10.0 False False 2.0 False 3.20441 n/a 10.0 35.0 25.0 70.0 150.0 200.0 u 20.0 300.0 3.0 True 0.0 True 2.0 False 5.0 False 2.0 0.764588 False False 1.0 4.0 15.0 1.59256 0.0 n/a 5.0 0.0 50.0 0 n/a True 1.0 False 1.0 3.0 0.172414 2.0 VISAGES 1.0 10.0 332 n/a 17.0 1.61294 5.98611 6.0 2.0 80.0 12.0 50.0 False True True True 1.5 False 17.0 0.944911 2.0 False +S19 40.0 0.396693 n/a n/a False -0.018355 1.0 True 3.0 n/a 2.0 10.0 0.958646 1.64286 True False 1.0 0.5 3.4 600.0 n/a 14.0 False 18.5 8.5 0.666667 30.0 14.0 45.0 False 0.0 6.0 4.0 2.0 0.623431 50.0 0.0 8.0 0.940291 3.0 25.0 4.0 59.0 42.0 n/a 5.0 0.0 3.0 DYSLEXIE DYSORTHOGRAPHIE PB EXPRESSION False 2.0 True 4.0 0.997793 0.589586 False 60.0 True True 2.0 False 0.590441 n/a 15.0 35.0 20.0 45.0 50.0 58.0 d 25.0 50.0 1.0 True 1.0 True 3.0 False 4.0 True 1.0 0.969703 False False 1.0 12.0 11.0 0.708503 2.0 0 9.0 2.0 40.0 0 n/a False 0.970941 True 2.0 4.0 0.243243 1.0 lieux 2.0 110.0 183 n/a 6.0 0.710534 8.53472 5.0 2.0 50.0 10.0 60.0 False True False True 1.5 False 23.0 1.14744 3.0 True +S20 65.0 0.580366 n/a n/a False -0.0676551 2.5 False 4.0 n/a 1.0 15.0 0.938926 1.875 False True 1.0 0.833333 2.0 300.0 n/a 8.0 False 11.5 8.0 0.666 30.0 15.0 45.0 False 0.0 9.0 0.0 3.0 0.757288 100.0 1.0 9.0 0.871271 3.0 30.0 5.0 63.0 45.0 n/a 8.0 0.0 3.0 0 False 4.0 True 2.0 0.996139 0.879881 False 50.0 False False 2.0 False 0.863822 n/a 15.0 40.0 25.0 50.0 70.0 80.0 d 20.0 60.0 3.0 False 0.0 True 2.0 False 5.0 False 2.0 0.675853 False True 1.0 10.0 20.0 0.867901 3.5 0 7.0 0.0 50.0 n/a n/a False 0.96733 False 1.0 3.0 0.304348 2.0 Visages 3.0 25.0 166 n/a 11.0 0.863093 7.51333 4.0 3.0 70.0 13.0 500.0 False True False False 7.0 False 15.0 0.861326 2.0 False +S21 75.0 0.827894 n/a n/a False -0.0550406 1.0 False 3.0 n/a 3.0 10.0 0.933896 1.5 False True 1.0 0.6 2.8 500.0 n/a 10.0 False 12.5 11.0 0.25 25.0 10.0 60.0 False 0.2 6.0 0.0 3.0 0.97081 30.0 0.0 9.0 0.878856 3.0 30.0 5.0 60.0 40.0 n/a 4.0 0.0 1.0 n/a False 4.0 True 2.0 0.995747 1.23959 False 20.0 False False 3.0 False 1.23225 n/a 15.0 40.0 25.0 45.0 90.0 100.0 d 20.0 85.0 3.0 False 0.0 True 2.0 False 4.0 False 2.0 0.885648 False False 0.0 10.0 13.0 1.10749 3.0 lieux 5.0 0.0 100.0 n/a n/a False 0.944038 False 0.0 0.0 0.2 1.0 visage 3.0 40.0 104 n/a 4.0 1.10645 1.875 12.0 3.0 60.0 11.0 80.0 False True True False 3.0 False 15.0 0.975003 2.0 False +S22 50.0 0.310351 n/a n/a False -0.249045 4.0 False 5.0 n/a 1.0 20.0 0.783854 1.5 False False 2.0 0.866667 4.4 300.0 n/a 12.0 False 15.0 7.0 0.666667 20.0 10.0 35.0 False 0.0 9.0 0.0 4.0 0.695147 50.0 2.0 10.0 0.534809 3.0 28.0 4.0 62.0 45.0 n/a 10.0 0.0 3.0 0 False 4.0 True 5.0 0.999154 0.471502 False 40.0 False False 3.0 False 0.461929 n/a 10.0 50.0 20.0 30.0 40.0 50.0 d 15.0 35.0 4.0 False 0.0 True 2.0 False 5.0 False 2.0 0.977155 False True 1.0 15.0 10.0 0.786574 4.33333 0 6.0 0.0 40.0 0 n/a False 0.997375 False 0.0 4.0 0.2 3.0 Visages 4.0 80.0 188 n/a 18.0 0.79227 9.20139 5.0 5.0 70.0 10.0 50.0 False True False False 2.5 False 18.0 0.955999 3.0 False +S23 50.0 0.508968 1.0 1.0 False -0.0350254 2.5 False 3.0 1.0 1.0 10.0 0.871767 1.54545 False True 1.0 0.433333 2.8 800.0 1.0 11.0 False 14.0 5.0 0.5 20.0 10.0 30.0 False 0.0 10.0 0.0 2.0 0.800143 15.0 0.0 10.0 0.836741 3.0 23.0 4.0 64.0 44.0 1.0 3.0 0.0 3.0 0 False 4.0 True 2.0 0.992409 0.7681 False 30.0 False True 2.0 False 0.757553 n/a 15.0 40.0 15.0 40.0 60.0 70.0 u 15.0 50.0 2.0 False 0.0 True 3.0 False 4.0 False 1.0 0.855351 False False 1.0 10.0 10.0 0.916341 0.0 n/a 6.0 0.0 40.0 0 n/a False 0.984198 False 1.0 2.0 0.214286 2.0 n/a 2.0 40.0 323 n/a 9.0 0.911936 6.14583 7.0 2.0 50.0 10.0 200.0 False True True False 2.0 False 17.0 1.14246 2.0 False +S24 60.0 0.671362 1.0 1.0 False -0.0573619 3.0 False 3.0 1.0 2.0 25.0 0.944763 0.947368 True True 2.0 0.5 3.2 300.0 1.0 19.0 False 18.5 8.0 0.333333 35.0 10.0 75.0 False 0.0 9.0 0.0 2.0 0.951386 600.0 1.0 9.0 0.887401 3.0 34.0 3.0 57.0 45.0 1.0 6.0 0.0 1.0 0 False 2.0 True 2.0 0.990636 1.00301 False 45.0 False True 1.0 False 0.999262 n/a 10.0 35.0 25.0 60.0 70.0 80.0 u 25.0 70.0 2.0 False 0.0 True 2.0 False 3.0 False 0.0 0.673082 False False 1.0 20.0 20.0 1.08045 0.0 VISAGES -1.0 2.0 30.0 0 n/a False 1.04792 False 2.0 1.5 -0.027027 1.0 LIEUX 3.0 500.0 335 n/a 14.0 1.08431 4.13194 7.0 4.0 90.0 10.0 300.0 False True True True 3.0 False 18.0 1.06108 2.0 False +S25 50.0 0.688949 1.0 1.0 False -0.0489149 1.0 False 4.0 1.0 1.0 20.0 0.948051 2.0 False True 0.0 0.566667 3.0 500.0 0.0 10.0 False 15.0 8.5 0.666667 40.0 10.0 60.0 False 0.0 10.0 0.0 3.0 0.875224 800.0 1.0 10.0 0.899136 3.0 40.0 5.0 76.0 35.0 1.0 7.0 0.0 3.0 n/a False 2.0 True 2.0 0.979872 1.04007 False 70.0 False False 2.0 False 1.02544 n/a 15.0 30.0 25.0 50.0 70.0 100.0 u 20.0 60.0 4.0 False 0.0 True 1.0 False 4.0 False 1.0 0.575015 False False 1.0 4.0 15.0 1.00105 3.33333 animaux 10.0 2.0 50.0 0 n/a False 0.991503 False 1.0 2.5 0.333333 2.0 n/a 3.0 10.0 9 n/a 6.0 0.997507 7.05556 4.0 3.0 50.0 16.0 6.0 False True False False 1.2 True 20.0 1.09846 3.0 False +S26 35.0 0.455105 n/a n/a False -0.00552304 1.0 False 2.0 n/a 2.0 5.0 0.96991 2.07692 True True 1.0 0.433333 1.8 240.0 n/a 13.0 True 20.0 12.0 0.25 20.0 10.0 35.0 False 0.2 9.0 3.0 1.0 0.801922 5.0 0.0 10.0 0.964387 3.0 32.0 5.0 64.0 43.0 n/a 4.0 1.0 3.0 dyslexie, pblm de: lecture, inversion de syllabes,dorganisation, emploi du tps False 4.0 True 4.0 0.996225 0.68226 False 10.0 True False 1.0 False 0.677383 n/a 10.0 20.0 17.0 40.0 50.0 60.0 d 15.0 45.0 2.0 True 0.0 True 3.0 False 4.0 True 2.0 0.610165 False False 1.0 6.0 7.0 0.919298 0.0 n/a 14.0 3.0 50.0 0 n/a False 0.969552 True 2.0 2.0 0.35 3.0 VISAGES LIEUX 3.0 15.0 347 n/a 6.0 0.913964 6.52083 5.0 3.0 60.0 10.0 4.0 False True True True 1.5 True 27.0 0.830617 3.0 False +S27 30.0 0.400822 1.0 1.0 False -0.0253511 2.0 False 4.0 1.0 2.0 4.0 0.941145 1.38462 False False 0.0 0.966667 4.2 300.0 1.0 13.0 False 15.5 8.0 0.75 20.0 10.0 40.0 False 0.0 10.0 0.0 3.0 0.676112 60.0 1.0 10.0 0.915794 3.0 27.0 4.0 65.0 42.0 1.0 10.0 0.0 3.0 0 False 4.0 True 4.0 0.998677 0.60153 False 80.0 False False 3.0 False 0.596588 n/a 15.0 30.0 20.0 40.0 50.0 60.0 d 20.0 40.0 4.0 False 0.0 True 1.0 False 4.0 False 2.0 0.870445 False True 1.0 15.0 16.0 0.768781 3.0 n/a 5.0 0.0 80.0 0 n/a False 0.993971 False 1.0 1.5 0.16129 1.0 VISAGES 4.0 100.0 331 n/a 8.0 0.770575 6.22917 7.0 4.0 50.0 11.0 100.0 False True False False 2.0 False 18.0 1.06635 2.0 False +S28 53.0 1.08503 n/a n/a False -0.0193036 4.0 False 3.0 n/a 3.0 15.0 0.918141 1.77778 True False 2.0 0.666667 3.2 600.0 n/a 9.0 False 12.5 8.0 0.583333 20.0 10.0 55.0 False 0.0 10.0 0.0 3.0 1.09877 25.0 2.0 9.0 0.898837 3.0 25.0 4.0 65.0 42.0 n/a 7.0 0.0 3.0 0 False 2.0 True 5.0 0.99648 1.60522 False 30.0 False False 2.0 False 1.61497 n/a 15.0 25.0 25.0 105.0 76.0 135.0 u 15.0 90.0 3.0 False 0.0 True 2.0 False 4.0 False 2.0 0.814187 False False 1.0 9.0 16.0 1.25582 2.0 n/a 7.0 2.0 50.0 0 n/a False 0.987764 False 1.0 1.5 0.28 3.0 VIGAGE 5.0 50.0 294 n/a 18.0 1.25228 6.56944 8.0 5.0 70.0 13.0 50.0 False True False True 12.0 False 16.0 0.81182 2.0 False +S29 34.0 0.403552 n/a n/a False -0.032888 3.5 False 3.0 n/a 2.0 5.0 0.915869 1.8 False True 2.0 0.433333 3.0 800.0 2.0 10.0 False 14.0 10.0 0.666667 15.0 10.0 30.0 False 0.0 8.0 0.0 3.0 0.737564 500.0 2.0 10.0 0.882981 3.0 33.0 4.0 57.0 42.0 1.0 5.0 0.0 3.0 0 False 2.0 True 4.0 0.997662 0.613726 False 40.0 False False 2.0 False 0.600651 n/a 10.0 20.0 20.0 35.0 47.0 60.0 d 15.0 35.0 4.0 False 0.0 True 1.0 False 4.0 False 2.0 0.404527 False False 1.0 10.0 15.0 0.84771 0.0 n/a 8.0 0.0 40.0 0 n/a False 0.987342 False 1.0 1.5 0.285714 3.0 VISAGES ANIMAUX 4.0 500.0 330 n/a 17.0 0.840613 7.01389 4.0 4.0 1.0 11.0 300.0 False True False False 3.0 False 18.0 1.08016 3.0 False +S30 60.0 0.46732 n/a n/a False -0.281506 1.0 False 4.0 n/a 1.0 50.0 0.818848 1.88889 False False 0.0 0.566667 3.6 400.0 n/a 9.0 False 13.0 10.0 0.75 30.0 10.0 40.0 False 0.5 9.0 0.0 3.0 0.757308 70.0 1.0 8.0 0.537342 3.0 25.0 5.0 62.0 42.0 n/a 7.0 0.0 3.0 0 False 4.0 True 4.0 0.9921 0.72291 False 250.0 False False 2.0 False 0.695564 n/a 15.0 40.0 30.0 90.0 60.0 60.0 u 20.0 40.0 3.0 False 0.0 True 3.0 False 3.0 False 2.0 0.78383 False False 1.0 15.0 15.0 0.864595 3.33333 0 8.0 0.0 50.0 nombre / espace n/a False 0.941167 False 1.0 4.0 0.307692 1.0 Visages 3.0 60.0 177 n/a 6.0 0.863115 8.60417 5.0 2.0 50.0 10.0 20.0 False True False False 1.0 False 17.0 1.05261 3.0 False +S31 40.0 0.580558 n/a n/a False 0.0131732 2.5 False 4.0 n/a 2.0 5.0 0.967509 1.46154 False True 1.0 0.533333 4.4 800.0 n/a 13.0 False 16.0 11.0 0.666667 20.0 11.0 40.0 False 0.0 10.0 0.0 1.0 0.868769 200.0 1.0 10.0 0.980682 3.0 30.0 4.0 63.0 45.0 n/a 4.0 0.0 2.0 0 False 4.0 True 3.0 0.999827 0.86083 False 600.0 False False 2.0 False 0.864108 n/a 12.0 25.0 18.0 50.0 60.0 70.0 d 14.0 60.0 4.0 False 0.0 True 5.0 False 4.0 False 0.0 0.789305 False False 1.0 7.0 12.0 0.993075 4.0 VISAGE 6.0 0.0 50.0 0 n/a False 1.00572 False 2.0 3.0 0.1875 2.0 LIEUX 3.0 150.0 295 n/a 11.0 0.99015 6.74306 5.0 4.0 80.0 10.0 300.0 False True True False 2.5 False 19.0 1.33373 2.0 False +S32 60.0 1.50179 n/a n/a False -0.0628016 0.0 False 4.0 n/a 1.0 10.0 0.937975 1.57143 False True 0.0 0.833333 3.6 500.0 0.0 14.0 False 18.0 7.0 n/a 40.0 15.0 120.0 False 0.0 10.0 0.0 3.0 1.12305 20.0 0.0 8.0 0.875174 3.0 27.0 4.0 64.0 43.0 n/a 9.0 0.0 1.0 0 False 4.0 True 5.0 0.998799 2.15269 False 60.0 False False 3.0 False 2.23528 n/a 15.0 40.0 30.0 150.0 100.0 150.0 d 30.0 170.0 4.0 False 1.0 True 0.0 False 4.0 False 0.0 0.866485 False False 1.0 10.0 15.0 1.26973 3.33333 Visages animaux 8.0 0.0 40.0 0 n/a False 0.994238 False 2.0 2.5 0.222222 1.0 lieux 5.0 150.0 185 n/a 2.0 1.27996 4.5625 5.0 5.0 80.0 14.0 15.0 True True False False 2.0 False 22.0 1.06178 n/a False +S33 80.0 1.00954 n/a n/a False -0.037087 2.0 False 3.0 n/a 3.0 6.0 0.970922 1.875 True True 1.0 0.733333 2.8 400.0 n/a 8.0 True 11.5 11.0 0.583333 35.0 10.0 90.0 False 0.2 7.0 2.0 4.0 1.07425 30.0 2.0 9.0 0.933835 3.0 32.0 4.0 65.0 42.0 n/a 10.0 0.0 3.0 apprentissage lecture False 3.0 True 4.0 0.999484 1.50266 False 80.0 False False 2.0 False 1.5026 n/a 15.0 50.0 25.0 90.0 100.0 110.0 u 25.0 100.0 3.0 True 0.0 True 1.0 False 5.0 False 1.0 0.882616 False False 1.0 20.0 15.0 1.22089 3.33333 0 7.0 2.0 100.0 0 n/a True 1.00767 False 1.0 2.0 0.304348 2.0 0 3.0 150.0 216 n/a 12.0 1.22434 6.61111 6.0 4.0 80.0 10.0 70.0 False True False False 2.5 False 15.0 1.04328 1.0 False +S34 39.0 0.546959 n/a n/a False -0.0169346 3.5 False 2.0 n/a 1.0 20.0 0.978523 1.77778 False False 2.0 0.766667 3.0 350.0 n/a 9.0 False 12.5 8.0 1.0 29.0 13.0 55.0 False 0.33 10.0 0.0 2.0 0.790664 50.0 2.0 10.0 0.961589 3.0 33.0 4.0 72.0 44.0 n/a 9.0 0.0 3.0 timbre de voix False 3.0 True n/a 0.999336 0.808399 False 90.0 False False 2.0 False 0.8141 n/a 13.0 36.0 21.0 50.0 60.0 70.0 d 18.0 60.0 4.0 False 0.0 True 0.0 False 3.0 False 1.0 0.95104 True False 1.0 17.0 13.0 0.897307 1.66667 0 7.0 0.0 40.0 n/a n/a False 1.03377 True 2.0 3.0 0.28 2.0 lieux 2.0 50.0 191 n/a 17.0 0.901132 7.875 4.0 2.0 75.0 16.0 100.0 False True True False 3.0 False 16.0 0.952927 3.0 False +S35 45.0 0.739662 n/a n/a False -0.0104976 3.0 False 4.0 n/a 1.0 4.0 0.956899 2.1 True False 1.0 0.533333 2.4 350.0 n/a 10.0 False 15.5 9.0 0.833333 30.0 12.0 50.0 False 0.6 7.0 0.0 1.0 0.966636 30.0 0.0 8.0 0.946401 3.0 32.0 4.0 70.0 43.0 n/a 3.0 0.0 1.0 positionement main gauche False 4.0 True 4.0 0.999391 1.07854 False 8.0 False False 2.0 False 1.10092 n/a 10.0 30.0 30.0 75.0 70.0 80.0 d 15.0 85.0 3.0 False 1.0 True 2.0 False 4.0 False 1.0 0.814216 True False 1.0 5.0 6.0 1.09427 2.66667 0 11.0 2.0 60.0 0 n/a False 1.02351 True 1.0 4.0 0.354839 1.0 0 4.0 60.0 192 n/a 10.0 1.10169 6.90278 6.0 1.0 50.0 13.0 20.0 True True False False 2.5 False 21.0 0.995345 2.0 False +S36 24.0 0.373996 n/a n/a False 0.0331708 0.5 False 4.0 n/a 1.0 4.0 0.885147 2.22222 False True 0.0 0.8 2.8 450.0 n/a 9.0 False 14.5 7.0 0.583333 20.0 11.0 39.0 False 0.5 9.0 0.0 3.0 0.668698 167.0 0.0 9.0 0.918318 3.0 28.0 4.0 55.0 43.0 n/a 7.0 0.0 3.0 0 False 4.0 True 2.0 0.998932 0.556324 False 30.0 False False 3.0 False 0.556659 n/a 13.0 15.0 16.0 35.0 45.0 50.0 u 15.0 41.0 4.0 False 0.0 True 2.0 False 4.0 False 1.0 0.856854 False True 1.0 7.0 11.0 0.768194 3.66667 0 11.0 0.0 45.0 0 n/a False 0.970847 False 1.0 1.0 0.37931 2.0 tout 2.0 30.0 200 n/a 3.0 0.762126 5.50694 5.0 2.0 70.0 12.0 40.0 False True True False 2.5 False 20.0 1.08659 3.0 False +S37 60.0 1.20749 n/a n/a False 0.00848409 4.0 False 0.0 n/a 3.0 20.0 0.911086 1.33333 False False 2.0 0.733333 3.8 300.0 n/a 9.0 False 10.5 9.0 0.833333 45.0 15.0 85.0 False 0.0 6.0 0.0 0.0 0.988676 60.0 2.0 10.0 0.91957 3.0 30.0 4.0 64.0 44.0 n/a 8.0 0.0 3.0 0 False 4.0 True 3.0 0.999972 1.76399 False 45.0 False False 3.0 False 1.79724 n/a 16.0 26.0 30.0 60.0 100.0 150.0 d 25.0 130.0 4.0 False 0.0 True 5.0 False 0.0 False 1.0 0.957402 False True 1.0 15.0 12.0 1.12971 0.0 n/a 3.0 0.0 50.0 0 n/a False 1.00563 False 2.0 4.0 0.142857 1.0 LIEUX,VISAGE 5.0 35.0 291 n/a 18.0 1.12681 8.63194 7.0 2.0 90.0 13.0 80.0 False True True False 2.5 False 12.0 0.938097 2.0 False +S38 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a 368 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a +S39 50.0 0.621052 n/a n/a False -0.0259647 0.5 False 5.0 n/a 1.0 25.0 0.923161 1.58333 False False 0.0 0.733333 2.8 800.0 n/a 12.0 False 15.5 10.0 0.666667 25.0 10.0 30.0 False 0.0 9.0 0.0 4.0 0.840421 110.0 0.0 10.0 0.897196 3.0 30.0 5.0 61.0 41.0 n/a 10.0 0.0 3.0 LANGUES False 4.0 True 5.0 0.995976 0.934155 False 50.0 False False 2.0 False 0.924379 n/a 15.0 30.0 20.0 60.0 70.0 80.0 d 20.0 60.0 2.0 False 0.0 True 2.0 False 4.0 False 2.0 0.947885 True False 1.0 13.0 10.0 0.962968 4.0 0 7.0 0.0 58.0 n/a n/a False 0.950016 False 2.0 4.0 0.225806 1.0 visages, lieux 4.0 100.0 139 n/a 3.0 0.957841 8.68056 4.0 5.0 80.0 10.0 30.0 False True False True 2.0 False 19.0 1.13179 3.0 False +S40 60.0 0.669262 n/a n/a False -0.120663 3.0 False 4.0 n/a 1.0 6.0 0.869703 1.26667 False True 2.0 0.85 2.8 400.0 n/a 15.0 False 17.0 6.0 0.75 30.0 12.0 35.0 False 0.29 10.0 0.0 3.0 0.798569 80.0 1.0 10.0 0.74904 3.0 22.0 3.0 61.0 42.0 0.0 7.0 0.0 2.0 0 False 4.0 True 2.0 0.988815 1.03409 False 100.0 False False 1.0 True 0.996137 n/a 15.0 30.0 28.0 50.0 70.0 110.0 d 18.0 45.0 4.0 False 0.0 True 0.0 False 3.0 False 2.0 0.917762 False False 1.0 7.0 18.0 0.923717 3.5 lieux 4.0 0.0 60.0 Chiffres lettres, noms, mots / couleurs, prenoms / gout, toucher, nombres / temps n/a False 1.01591 False 1.0 2.0 0.117647 2.0 Visages 3.0 50.0 197 n/a 14.0 0.910141 5.83333 6.0 2.0 70.0 10.0 90.0 False True False False 2.0 False 19.0 1.1343 2.0 False +S41 50.0 0.634911 n/a n/a False -0.123459 1.5 False 4.0 n/a 3.0 6.0 0.911603 1.33333 False True 0.0 0.8 5.0 400.0 n/a 12.0 False 14.0 10.0 0.583333 25.0 10.0 40.0 False 0.0 10.0 0.0 3.0 0.892371 60.0 1.0 10.0 0.788143 3.0 27.0 3.0 63.0 41.0 n/a 10.0 0.0 3.0 0 False 2.0 True 2.0 0.994467 0.985329 False 75.0 False False 2.0 False 0.945008 n/a 12.0 30.0 20.0 50.0 80.0 90.0 d 15.0 40.0 4.0 False 0.0 True 1.0 False 5.0 False 1.0 0.910247 False False 1.0 20.0 10.0 1.03135 2.0 n/a 4.0 0.0 50.0 0 n/a False 1.035 False 1.0 1.0 0.142857 1.0 n/a 4.0 80.0 348 n/a 7.0 1.01705 5.29861 7.0 4.0 40.0 11.0 50.0 False True True False 3.0 False 16.0 0.979685 2.0 False +S42 70.0 0.971599 n/a n/a False -0.0145183 3.0 False 3.0 n/a 3.0 20.0 0.93927 1.83333 False False 1.0 0.9 3.4 500.0 n/a 12.0 False 17.0 10.0 0.666667 30.0 15.0 77.0 False 0.0 10.0 0.0 2.0 0.955744 50.0 1.0 10.0 0.924752 3.0 32.0 4.0 65.0 44.0 2.0 10.0 0.0 3.0 0 True 4.0 True 4.0 0.99983 1.46297 False 250.0 False False 3.0 False 1.44614 n/a 15.0 40.0 20.0 70.0 90.0 130.0 d 25.0 80.0 4.0 False 0.0 True 0.0 False 4.0 False 2.0 0.893647 False False 1.0 15.0 15.0 1.09782 2.0 n/a 10.0 0.0 70.0 0 n/a False 1.01353 False 2.0 2.0 0.294118 3.0 VISAGE, LIEUX,PHYSIONOMIE 5.0 130.0 324 n/a 12.0 1.08928 6.53472 9.0 4.0 65.0 11.0 50.0 False True False False 4.0 False 22.0 1.00161 2.0 False +S43 50.0 0.444483 n/a n/a False -0.0592845 2.5 False 3.0 n/a 2.0 35.0 0.889422 1.91667 False False 2.0 0.933333 3.2 600.0 n/a 12.0 False 17.5 7.0 0.916667 25.0 15.0 40.0 False 0.0 10.0 0.0 2.0 0.608799 40.0 1.0 10.0 0.830138 3.0 22.0 4.0 68.0 43.0 n/a 9.0 1.0 3.0 0 False 2.0 True 3.0 0.988576 0.669578 False 100.0 False False 2.0 False 0.661573 n/a 20.0 50.0 25.0 50.0 60.0 70.0 u 25.0 50.0 4.0 False 0.0 True 1.0 False 4.0 False 0.0 0.8933 False False 1.0 12.0 18.0 0.692751 3.0 VISAGES 11.0 0.0 50.0 0 n/a False 0.988251 False 2.0 3.0 0.314286 1.0 LIEUX 5.0 40.0 349 n/a 13.0 0.693858 7.93056 6.0 4.0 60.0 12.0 25.0 False True False True 2.5 False 23.0 0.986973 3.0 False +S44 60.0 1.05413 n/a n/a False -0.0291271 5.0 False 4.0 n/a 2.0 10.0 0.913654 1.07692 False True 2.0 0.666667 2.4 600.0 n/a 13.0 False 13.5 10.0 0.833333 50.0 15.0 65.0 False 0.0 10.0 0.0 3.0 0.863541 20.0 2.0 7.0 0.884527 3.0 25.0 5.0 55.0 42.0 n/a 10.0 0.0 3.0 0 False 4.0 True 2.0 0.99285 1.59484 False 100.0 False True 2.0 True 1.56897 n/a 25.0 40.0 25.0 78.0 115.0 150.0 u 30.0 85.0 3.0 False 1.0 True 2.0 False 3.0 False 2.0 0.6925 False False 1.0 6.0 15.0 0.99406 0.0 n/a 1.0 0.0 50.0 0 n/a False 0.920358 False 2.0 1.5 0.037037 3.0 VISAGE ET LIEUX 2.0 15.0 293 n/a 20.0 0.984191 6.73611 6.0 1.0 80.0 13.0 6.0 False True False False 3.0 False 14.0 0.943294 3.0 False +S45 30.0 0.287899 n/a n/a False -0.0142111 1.5 False 4.0 n/a 3.0 30.0 0.89745 2.4 False True 1.0 0.733333 3.4 600.0 n/a 10.0 False 17.0 6.0 0.583333 20.0 6.0 20.0 False 0.25 9.0 0.0 3.0 0.706925 80.0 1.0 9.0 0.883239 3.0 27.0 5.0 70.0 45.0 n/a 7.0 0.0 3.0 0 False 4.0 True 3.0 0.992768 0.419834 False 30.0 False False 2.0 False 0.428512 n/a 12.0 25.0 15.0 30.0 30.0 40.0 u 12.0 40.0 2.0 False 0.0 True 2.0 False 5.0 False 1.0 0.912762 False False 1.0 8.0 12.0 0.796829 3.33333 0 14.0 0.0 40.0 0 n/a False 0.977134 False 2.0 2.5 0.411765 1.0 lieux 3.0 60.0 170 n/a 9.0 0.805694 7.23611 6.0 3.0 50.0 10.0 100.0 False True False False 3.0 False 24.0 1.04265 4.0 False +S46 50.0 0.719223 n/a n/a False -0.0376729 3.0 False 2.0 n/a 1.0 150.0 0.917437 1.69231 True True 2.0 0.733333 2.6 400.0 n/a 13.0 False 17.5 6.0 0.5 25.0 15.0 80.0 False 0.0 10.0 0.0 2.0 0.927479 40.0 1.0 10.0 0.879764 3.0 30.0 5.0 52.0 40.0 0.0 8.0 0.0 3.0 0 False 4.0 True 4.0 0.994182 1.05988 False 200.0 False False 2.0 False 1.0705 n/a 10.0 30.0 20.0 70.0 65.0 80.0 d 20.0 75.0 1.0 False 0.0 True 4.0 False 3.0 False 2.0 0.743006 False False 1.0 20.0 13.0 1.05708 1.0 FLEURS 9.0 2.0 50.0 0 n/a False 0.919182 False 2.0 2.5 0.257143 1.0 VISAGES LIEUX 4.0 150.0 337 n/a 14.0 1.05706 7.20833 6.0 4.0 80.0 15.0 100.0 False True True True 3.0 False 22.0 0.976954 2.0 False +S47 50.0 0.747239 n/a n/a False -0.0657451 4.0 False 4.0 n/a 2.0 n/a 0.91669 1.81818 False True 2.0 0.533333 3.6 n/a n/a 11.0 False 15.5 n/a 0.916667 25.0 12.0 45.0 False 0.0 6.0 0.0 2.0 0.839307 n/a 2.0 10.0 0.850945 3.0 30.0 4.0 60.0 45.0 n/a 9.0 0.0 3.0 0 False 2.0 True 2.0 0.999447 1.11427 False n/a False False 3.0 False 1.1122 n/a 18.0 40.0 30.0 45.0 100.0 90.0 d 20.0 80.0 1.0 False 2.0 True 1.0 False 4.0 False 1.0 n/a False False 1.0 n/a n/a 0.95479 2.66667 0 9.0 0.0 n/a n/a n/a False 0.997244 False 1.0 2.5 0.290323 2.0 0 4.0 n/a 218 n/a 18.0 0.956572 7.24306 9.0 4.0 n/a 10.0 n/a False True False False n/a False 20.0 n/a 3.0 False +S48 30.0 0.507131 n/a n/a False -0.00956098 0.5 False 2.0 n/a 1.0 20.0 0.939729 2.77778 False True 0.0 0.733333 4.0 500.0 n/a 9.0 False 17.0 7.0 0.833333 20.0 10.0 40.0 False 0.0 10.0 0.0 3.0 0.824241 40.0 1.0 10.0 0.930168 3.0 30.0 5.0 65.0 43.0 n/a 9.0 0.0 2.0 0 False 4.0 True 4.0 0.996104 0.752623 False 20.0 False False 2.0 True 0.754819 n/a 10.0 20.0 15.0 30.0 50.0 70.0 d 15.0 50.0 4.0 False 0.0 True 0.0 False 4.0 False 1.0 0.917877 False False 1.0 15.0 7.0 0.943009 2.33333 lieux 16.0 0.0 52.0 n/a n/a False 0.96704 False 0.0 0.0 0.470588 1.0 Visages 4.0 70.0 168 n/a 5.0 0.9394 4.09028 7.0 5.0 50.0 13.0 30.0 False True True False 3.0 False 25.0 0.966885 2.0 False +S49 30.0 0.329163 n/a n/a False -0.0534856 2.0 False 3.0 n/a 1.0 7.0 0.781903 2.09091 False False 1.0 0.8 3.0 400.0 n/a 11.0 True 17.0 10.0 0.833333 20.0 10.0 25.0 False 0.0 9.0 3.0 3.0 0.616801 30.0 2.0 9.0 0.728418 3.0 27.0 4.0 62.0 42.0 n/a 7.0 0.0 3.0 APPRENTISSAGE LECTURE / DYSLEXIE False 4.0 True 3.0 0.999214 0.50128 False 50.0 False False 2.0 False 0.489929 n/a 10.0 20.0 30.0 25.0 50.0 55.0 u 20.0 35.0 2.0 True 0.0 True 1.0 True 3.0 True 2.0 0.942988 False False 1.0 8.0 10.0 0.704073 3.0 0 12.0 0.0 40.0 0 n/a True 0.985763 True 1.0 3.5 0.352941 2.0 Visages 3.0 100.0 171 n/a 12.0 0.702978 8.17361 5.0 4.0 45.0 10.0 60.0 False True False False 1.2 False 23.0 1.1189 2.0 False +S50 60.0 0.801137 n/a n/a False -0.0291117 0.5 False 4.0 n/a 1.0 50.0 0.98375 1.66667 False True 0.5 0.666667 2.6 n/a n/a 9.0 False 12.0 10.0 0.666667 40.0 15.0 80.0 False 0.25 10.0 0.0 3.0 0.826063 60.0 0.0 10.0 0.954638 3.0 25.0 5.0 63.0 43.0 n/a 7.0 1.0 3.0 n/a False 4.0 True 3.0 0.991647 1.16622 False 30.0 False False 2.0 False 1.19242 n/a 20.0 50.0 30.0 70.0 80.0 95.0 u 27.0 100.0 4.0 False 0.0 True 1.0 False 4.0 False 0.0 n/a False False 1.0 8.0 12.5 0.933209 3.33333 visage 6.0 0.0 70.0 n/a n/a False 0.946907 False 1.0 1.5 0.25 1.0 n/a 3.0 150.0 117 n/a 4.0 0.941477 6.13889 4.0 3.0 75.0 10.0 250.0 False False True True 1.5 False 15.0 n/a 2.0 False +S51 120.0 0.902599 n/a n/a False -0.231889 4.0 False 3.0 n/a 2.0 10.0 0.752758 1.71429 False True 1.0 0.833333 2.6 700.0 n/a 7.0 False 9.5 7.0 0.833333 50.0 17.0 54.0 False 0.17 10.0 0.0 2.0 0.812932 30.0 2.0 10.0 0.520869 3.0 30.0 4.0 60.0 40.0 n/a 7.0 0.0 2.0 0 False 4.0 True 3.0 0.999712 1.25798 False 200.0 False False 2.0 False 1.34344 n/a 20.0 80.0 42.0 120.0 50.0 90.0 d 30.0 160.0 4.0 False 0.0 True 2.0 False 4.0 False 1.0 0.89375 False False 1.0 10.0 18.0 0.90344 2.66667 0 5.0 0.0 40.0 n/a n/a False 0.982427 False 1.0 1.5 0.263158 2.0 0 2.0 100.0 173 n/a 16.0 0.926512 5.69444 8.0 3.0 60.0 11.0 115.0 False True True False 2.0 False 12.0 1.1715 3.0 False +S52 55.0 0.87824 n/a n/a False -0.00832569 2.0 False 5.0 n/a 1.0 20.0 0.971116 1.77778 True True 1.0 0.766667 2.6 400.0 n/a 9.0 False 12.5 7.0 0.5 35.0 10.0 75.0 False 0.0 8.0 0.0 2.0 1.0228 75.0 1.0 7.0 0.96279 3.0 25.0 4.0 61.0 42.0 n/a 9.0 0.0 1.0 0 False 4.0 True 1.0 0.997485 1.29562 False 150.0 False False 1.0 True 1.30718 n/a 12.0 30.0 25.0 80.0 80.0 100.0 u 25.0 90.0 3.0 False 0.0 True 2.0 False 4.0 False 2.0 0.855701 False False 1.0 20.0 12.0 1.16281 3.66667 0 7.0 2.0 60.0 0 n/a False 0.976732 False 1.0 2.0 0.28 2.0 Visages 3.0 100.0 206 n/a 10.0 1.1657 4.66667 4.0 5.0 60.0 10.0 15.0 False True False False 2.0 False 16.0 1.02892 2.0 False +S53 57.0 0.721953 1.0 1.0 False -0.038159 2.0 False 3.0 1.0 2.0 21.0 0.949123 2.0 False True 1.0 0.6 2.0 400.0 1.0 10.0 False 15.0 7.0 0.666667 18.0 8.0 47.0 False 0.5 10.0 0.0 2.0 1.04459 500.0 2.0 9.0 0.910964 3.0 25.0 4.0 53.0 34.0 1.0 8.0 0.0 3.0 "confusion entre ""p""et""b"",""a"" et""d"",""v""et""f"" a9ans pendant3-4mois " True 2.0 False 3.0 0.999318 1.09054 False 40.0 False False 2.0 False 1.07456 n/a 11.0 36.0 22.0 52.0 78.0 89.0 u 13.0 61.0 2.0 False 1.0 True 6.0 True 3.0 False 1.0 0.727899 False False 1.0 9.0 17.0 1.19193 0.0 n/a 10.0 0.0 40.0 0 n/a False 0.92573 True 1.0 1.5 0.333333 1.0 n/a 4.0 60.0 299 n/a 12.0 1.19054 6.53472 5.0 4.0 70.0 12.0 12.0 False True False False 1.8 False 20.0 1.04877 3.0 False +S54 38.0 0.383918 n/a 0.0 False -0.103711 1.0 False 3.0 n/a 3.0 5.0 0.86639 1.8 True True 1.0 0.666667 2.8 300.0 n/a 10.0 False 14.0 12.0 0.75 20.0 10.0 30.0 False 0.33 8.0 1.0 3.0 0.731965 10.0 1.0 9.0 0.76268 3.0 30.0 4.0 64.0 42.0 n/a 9.0 0.0 2.0 DYSORTHOGRAPHIE DYSLEXIE False 3.0 True 2.0 0.999901 0.594111 False 20.0 False False 2.0 False 0.571427 n/a 10.0 25.0 15.0 25.0 50.0 60.0 u 12.0 30.0 4.0 True 0.0 True 1.0 True 4.0 True 2.0 0.799681 False False 0.0 4.0 8.0 0.846727 3.0 noms 8.0 2.0 45.0 n/a n/a False 0.999775 True 1.0 1.5 0.285714 1.0 Visages 2.0 12.0 179 n/a 6.0 0.834232 4.625 12.0 2.0 40.0 10.0 50.0 False True True False 1.5 False 18.0 0.95225 3.0 False +S55 38.0 0.351037 n/a n/a False -0.0959172 2.5 False 2.0 n/a 2.0 15.0 0.874188 1.4 True True 2.0 0.53 2.6 500.0 n/a 10.0 False 12.0 8.0 0.5 19.0 9.0 25.0 False 0.0 10.0 0.0 2.0 0.670693 75.0 1.0 7.0 0.778271 3.0 28.0 4.0 75.0 45.0 n/a 5.0 1.0 3.0 0 False 3.0 True 1.0 0.997022 0.542072 False 35.0 False False 1.0 True 0.522487 n/a 13.0 27.0 20.0 39.0 45.0 57.0 d 15.0 29.0 4.0 False 0.0 True 2.0 False 3.0 False 1.0 0.969419 False False 1.0 10.0 13.0 0.771524 2.0 n/a 4.0 3.0 45.0 0 n/a False 1.03044 False 2.0 3.0 0.166667 3.0 LIEUX 2.0 50.0 297 n/a 13.0 0.764399 7.08333 6.0 1.0 55.0 10.0 75.0 False True True False 2.5 True 14.0 1.02732 2.0 False +S56 50.0 0.728235 1.0 1.0 False -0.0200327 2.5 False 3.0 1.0 2.0 13.0 0.958526 1.55556 False False 1.0 0.7 3.0 450.0 1.0 9.0 False 11.5 9.0 0.666667 30.0 10.0 40.0 False 0.0 8.0 0.0 2.0 0.891965 35.0 2.0 9.0 0.938493 3.0 32.0 5.0 62.0 44.0 1.0 6.0 0.0 3.0 zozottement False 3.0 True 4.0 0.996171 1.08598 False 45.0 False False 2.0 False 1.08391 n/a 15.0 30.0 20.0 50.0 70.0 100.0 d 20.0 70.0 0.0 False 1.0 True 1.0 False 4.0 False 2.0 0.976141 True False 1.0 13.0 14.0 1.02026 2.66667 n/a 5.0 0.0 45.0 0 n/a False 0.966929 True 1.0 1.0 0.217391 1.0 visage 3.0 75.0 39 n/a 13.0 1.01659 6.15972 5.0 3.0 80.0 13.0 35.0 False True True True 3.0 False 14.0 0.967209 2.0 False +S57 45.0 0.543197 n/a n/a False -0.036005 0.5 False 4.0 n/a 1.0 20.0 0.969654 2.0 False False 0.0 0.766667 2.4 700.0 n/a 9.0 False 13.5 6.5 0.583333 30.0 10.0 60.0 False 0.13 10.0 0.0 1.0 0.817328 30.0 1.0 10.0 0.933649 3.0 25.0 4.0 60.0 45.0 n/a 10.0 0.0 3.0 0 False 3.0 True 4.0 0.996329 0.804771 False 50.0 False False 2.0 False 0.8085 n/a 15.0 30.0 25.0 50.0 55.0 70.0 d 17.0 60.0 1.0 False 0.0 True 0.0 False 4.0 False 2.0 0.930744 False False 0.0 10.0 15.0 0.927787 2.33333 0 9.0 0.0 50.0 0 n/a False 0.98254 False 2.0 3.0 0.333333 2.0 visages, lieux 4.0 25.0 181 n/a 3.0 0.931521 7.61111 4.0 2.0 80.0 12.0 80.0 False True True False 1.2 False 18.0 1.14636 3.0 False +S58 49.0 0.482002 n/a n/a False -0.0484288 1.5 False 5.0 n/a 1.0 10.0 0.95826 2.5 False False 1.0 0.933333 4.2 450.0 n/a 8.0 False 14.0 6.0 0.833333 30.0 10.0 50.0 False 0.2 9.0 0.0 4.0 0.770706 30.0 1.0 9.0 0.909831 3.0 35.0 4.0 62.0 45.0 n/a 9.0 0.0 3.0 0 False 4.0 True 4.0 0.997881 0.72737 False 50.0 False False 3.0 False 0.717416 n/a 15.0 30.0 20.0 50.0 55.0 65.0 u 20.0 50.0 4.0 False 0.0 True 4.0 False 5.0 False 1.0 0.950643 False True 1.0 14.0 12.0 0.880939 4.33333 0 12.0 0.0 50.0 0 n/a False 1.01537 False 1.0 3.0 0.428571 2.0 0 4.0 30.0 201 n/a 9.0 0.878385 8.06944 4.0 4.0 100.0 10.0 40.0 False True True False 2.5 False 20.0 1.01326 3.0 False +S59 80.0 1.21402 n/a n/a False -0.0345568 0.0 False 3.0 n/a 1.0 15.0 0.975677 1.46154 False False 1.0 0.6 4.2 400.0 n/a 13.0 False 16.0 8.0 0.583333 40.0 10.0 100.0 False 0.0 8.0 0.0 4.0 1.14589 100.0 0.0 8.0 0.94112 3.0 35.0 5.0 60.0 40.0 n/a 4.0 0.0 3.0 0 False 4.0 True 3.0 0.992796 1.81669 False 50.0 False False 3.0 False 1.80695 n/a 15.0 40.0 30.0 100.0 100.0 150.0 d 20.0 100.0 3.0 False 0.0 True 1.0 False 3.0 False 1.0 0.748922 False False 0.0 20.0 100.0 1.30699 3.5 0 6.0 0.0 50.0 0 n/a False 0.956471 False 1.0 3.0 0.1875 3.0 0 3.5 60.0 203 n/a 2.0 1.30599 7.65278 n/a 4.0 100.0 15.0 30.0 False True True False 5.0 False 19.0 0.806267 2.0 False +S60 45.0 0.705189 1.0 1.0 False -0.0101898 0.0 False 3.0 1.0 1.0 7.0 0.974984 1.55556 False False 0.0 0.933333 3.6 380.0 1.0 9.0 False 11.5 8.5 0.416667 30.0 12.0 55.0 False 0.333333 10.0 0.0 3.0 0.828774 10.0 0.0 9.0 0.964794 3.0 30.0 5.0 64.0 45.0 1.0 10.0 0.0 2.0 n/a False 4.0 True 2.0 0.996178 1.04281 False 20.0 False n/a 3.0 False 1.04961 n/a 15.0 35.0 30.0 50.0 75.0 95.0 d 25.0 75.0 3.0 False 0.0 True 1.0 False 5.0 False 2.0 0.680142 False False 0.0 12.0 12.0 0.939798 3.0 lieux 5.0 0.0 50.0 0 n/a False 0.970066 False 0.0 2.5 0.217391 1.0 visage 3.0 40.0 132 n/a 0.0 0.944566 5.28472 7.0 5.0 50.0 12.0 10.0 False True True False 7.0 False 14.0 0.738193 2.0 False +S61 30.0 0.420859 n/a n/a False -0.0346947 1.0 False 3.0 n/a 3.0 17.5 0.946556 2.45455 False False 2.0 0.5 3.4 400.0 n/a 11.0 False 19.0 8.0 0.833333 20.0 10.0 30.0 False 0.666667 9.0 0.0 2.0 0.753665 100.0 1.0 8.0 0.911862 3.0 29.0 3.0 60.0 45.0 n/a 1.0 1.0 3.0 0 False 2.0 True 3.0 0.994075 0.603338 False 40.0 False False 1.0 False 0.626411 n/a 10.0 20.0 15.0 30.0 40.0 50.0 u 15.0 60.0 1.0 False 0.0 True 3.0 False 3.0 False 0.0 0.853415 False False 1.0 10.0 15.0 0.854203 2.5 physionomie 16.0 0.0 52.0 n/a n/a False 1.044 False 2.0 4.0 0.421053 2.0 lieux 3.0 25.0 199 n/a 10.0 0.858964 8.25694 9.0 3.0 50.0 11.0 200.0 False True False False 2.0 False 27.0 1.02602 3.0 False +S62 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a 367 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a +S63 40.0 0.710036 1.0 1.0 False -0.00756445 1.0 False 4.0 1.0 3.0 5.0 0.952403 1.85714 False True 0.0 0.833333 2.4 1000.0 1.0 7.0 False 10.0 8.0 0.583333 25.0 10.0 60.0 False 0.0 10.0 0.0 2.0 0.912774 800.0 1.0 10.0 0.944839 3.0 25.0 3.5 60.0 42.0 1.0 9.0 0.0 2.0 0 False 2.0 True 1.0 0.997006 1.03295 False 400.0 False True 2.0 False 1.05682 n/a 15.0 25.0 20.0 70.0 60.0 80.0 u 20.0 80.0 4.0 False 0.0 True 3.0 False 4.0 False 2.0 0.235942 False False 0.0 4.0 8.0 1.03665 3.0 LIEUX 6.0 0.0 50.0 0 n/a False 0.996833 False 0.0 1.0 0.3 1.0 VISAGES 2.0 200.0 325 n/a 4.0 1.0403 3.75694 11.0 1.0 60.0 14.0 500.0 False True True False 500.0 False 13.0 0.782561 2.0 False +S64 40.0 0.526118 n/a n/a False -0.000933116 4.0 False 4.0 n/a 1.0 50.0 0.971842 1.7 False False 2.0 0.4 2.4 600.0 0.0 10.0 False 13.5 7.0 0.75 20.0 10.0 40.0 False 0.75 8.0 1.0 3.0 0.88201 30.0 2.0 7.0 0.970909 3.0 36.0 5.0 60.0 40.0 n/a 4.0 0.0 3.0 0 False 2.0 True 1.0 0.991759 0.772525 False 10.0 False False 1.0 False 0.783079 n/a 10.0 25.0 15.0 50.0 50.0 60.0 u 15.0 60.0 1.0 True 0.0 True 3.0 False 4.0 False 2.0 0.726744 False False 1.0 3.0 20.0 1.00469 0.0 ESPECES ANIMALES 7.0 0.0 45.0 0 n/a True 0.958743 False 1.0 2.5 0.259259 2.0 VISAGE 1.0 40.0 296 n/a 18.0 1.00524 7.35417 5.0 1.0 50.0 12.0 20.0 False True False False 2.0 False 17.0 0.975383 3.0 False +S65 30.0 0.422172 1.0 1.0 False -0.0217241 3.5 False 3.0 1.0 1.0 10.0 0.956833 1.58333 False False 2.0 0.866667 3.8 500.0 1.0 12.0 False 15.5 7.0 0.916667 20.0 10.0 40.0 False 0.0 10.0 0.0 4.0 0.757414 40.0 2.0 10.0 0.935109 3.0 30.0 5.0 64.0 43.0 1.0 8.0 0.0 3.0 0 False 3.0 True 4.0 0.996173 0.615527 False 60.0 False False 3.0 False 0.628364 n/a 10.0 30.0 20.0 30.0 40.0 60.0 d 15.0 50.0 4.0 False 0.0 True 1.0 False 4.0 False 1.0 0.939091 False False 1.0 30.0 12.0 0.853278 2.0 n/a 7.0 0.0 55.0 0 n/a False 0.964347 False 1.0 2.5 0.225806 2.0 n/a 4.0 70.0 327 n/a 17.0 0.863237 8.05556 4.0 4.0 80.0 10.0 40.0 False True False False 3.0 False 19.0 0.994149 3.0 False +S66 50.0 0.602292 n/a n/a False -0.0338606 1.5 False 4.0 n/a 1.0 20.0 0.934056 2.11111 False False 0.0 0.6 3.2 400.0 n/a 9.0 False 14.0 9.0 0.5 15.0 7.0 35.0 False 0.0 10.0 0.0 3.0 1.0295 25.0 1.0 9.0 0.900195 3.0 25.0 3.0 65.0 42.0 n/a 8.0 0.0 3.0 0 False 4.0 True 3.0 0.992627 0.904788 False 35.0 False False 3.0 False 0.896458 n/a 10.0 30.0 15.0 50.0 50.0 80.0 u 10.0 50.0 4.0 False 0.0 True 1.0 False 5.0 False 2.0 0.894138 False False 1.0 20.0 15.0 1.17632 0.0 n/a 10.0 0.0 50.0 0 n/a False 1.03726 False 2.0 3.0 0.357143 1.0 VISAGES LIEUX 3.0 90.0 344 n/a 7.0 1.17333 7.27083 5.0 3.0 80.0 12.0 20.0 False True False True 2.0 False 19.0 0.942724 2.0 False +S67 50.0 0.760311 n/a n/a False -0.090743 0.5 False 3.0 n/a 2.0 40.0 0.957141 1.75 False False 0.0 0.7 2.8 300.0 n/a 8.0 False 11.0 7.0 0.166667 40.0 12.0 60.0 False 0.25 8.0 0.0 2.0 0.895573 50.0 0.0 10.0 0.866398 3.0 32.0 5.0 65.0 44.0 2.0 5.0 0.0 3.0 0 False 3.0 True 2.0 0.996432 1.11832 False 150.0 False False 2.0 True 1.13165 n/a 15.0 45.0 25.0 100.0 70.0 90.0 u 25.0 80.0 3.0 False 0.0 True 2.0 False 5.0 False 1.0 0.719087 False False 1.0 3.0 12.0 1.01291 2.33333 0 6.0 0.0 58.0 Chiffres, voyelles en couleur n/a False 0.975137 False 2.0 3.0 0.272727 1.0 Lieux, itineraires 2.0 40.0 215 n/a 3.0 1.0207 6.49306 5.0 2.0 80.0 10.0 8.0 False True True False 2.0 False 14.0 1.00441 1.0 False +S68 42.0 0.518261 n/a n/a False -0.0204349 2.0 False 5.0 n/a 1.0 5.0 0.936235 1.88889 False False 1.0 1.0 4.2 700.0 n/a 9.0 False 13.0 7.0 0.833333 27.0 12.0 47.0 False 0.666667 10.0 1.0 3.0 0.753259 15.0 1.0 10.0 0.9158 3.0 33.0 4.0 63.0 43.0 n/a 10.0 0.0 3.0 n/a False 4.0 True 5.0 0.999161 0.76944 False 50.0 True False 3.0 False 0.771384 n/a 12.0 27.0 23.0 32.0 58.0 72.0 u 21.0 59.0 1.0 True 0.0 True 0.0 False 5.0 False 1.0 0.850019 False False 1.0 8.0 15.0 0.858164 4.0 n/a 8.0 0.0 40.0 0 n/a False 1.00769 False 2.0 4.0 0.307692 1.0 lieux 5.0 50.0 94 n/a 10.0 0.858501 8.90278 6.0 5.0 60.0 16.0 130.0 False True False False 3.0 False 17.0 1.08324 3.0 False +S69 40.0 0.320483 n/a n/a False -0.0823311 4.0 False 4.0 n/a 1.0 32.5 0.906829 2.14286 False False 2.0 0.7 4.2 450.0 n/a 7.0 False 11.0 9.0 0.5 20.0 13.0 40.0 False 0.0 7.0 0.0 4.0 0.601481 150.0 2.0 9.0 0.824498 3.0 25.0 5.0 60.0 48.0 n/a 8.0 0.0 3.0 n/a False 4.0 True 4.0 0.989427 0.488542 False 2500.0 False False 2.0 True 0.47701 n/a 12.0 30.0 25.0 40.0 45.0 50.0 u 20.0 35.0 4.0 False 0.0 True 3.0 False 5.0 False 2.0 0.554342 False False 1.0 8.0 15.0 0.68626 4.0 n/a 8.0 0.0 35.0 couleur, mot, espace n/a False 0.95227 False 2.0 4.0 0.363636 2.0 visage, lieux 4.0 200.0 105 n/a 18.0 0.685518 9.0 4.0 5.0 70.0 13.0 10.0 False True False False 2.5 False 15.0 1.11756 3.0 False +S70 350.0 4.37116 n/a n/a False -0.082708 3.0 False 4.0 n/a 1.0 15.0 0.923019 1.5 False False 2.0 0.766667 3.8 500.0 n/a 10.0 False 12.5 9.0 0.833333 50.0 15.0 250.0 False 0.0 8.0 0.0 3.0 1.71511 20.0 2.0 10.0 0.840311 3.0 25.0 4.0 68.0 43.0 n/a 8.0 0.0 3.0 0 False 4.0 True 4.0 0.995391 6.66643 False 200.0 False False 3.0 False 6.50608 n/a 15.0 100.0 30.0 200.0 400.0 500.0 d 20.0 300.0 2.0 False 0.0 True 1.0 False 5.0 False 2.0 0.832625 False False 1.0 5.0 6.0 1.97093 3.33333 0 5.0 0.0 40.0 Odeurs, images : souvenirs n/a False 0.998561 False 0.0 3.0 0.2 1.0 Visages 5.0 70.0 187 n/a 16.0 1.95474 8.42361 5.0 5.0 40.0 14.0 50.0 False True True False 3.0 False 15.0 1.0604 4.0 False +S71 20.0 0.212617 n/a n/a False -0.0629865 1.5 False n/a n/a 2.0 15.0 0.830302 1.55556 False False 0.0 0.5 3.2 400.0 n/a 9.0 False 11.5 8.0 0.5 15.0 10.0 20.0 False 0.0 6.0 0.0 n/a 0.516706 40.0 1.0 7.0 0.767316 3.0 25.0 4.0 60.0 42.0 n/a 3.0 0.0 3.0 0 False 3.0 True 2.0 0.997657 0.325419 False 50.0 False False 2.0 False 0.316461 n/a 10.0 20.0 15.0 20.0 30.0 40.0 u 10.0 20.0 1.0 False 0.0 True 2.0 False n/a False 2.0 0.968262 False False 1.0 15.0 10.0 0.594702 n/a 0 5.0 0.0 50.0 n/a n/a False 0.97386 False 1.0 3.0 0.217391 1.0 Visages 2.0 60.0 159 n/a 7.0 0.588898 7.16667 6.0 3.0 100.0 10.0 100.0 False True True False 2.0 False 14.0 1.05611 3.0 False +S72 60.0 0.715723 1.0 1.0 False -0.0551373 2.0 False 2.0 2.0 1.0 40.0 0.958627 1.33333 True True 1.0 0.433333 3.6 450.0 1.0 15.0 False 17.5 7.0 0.416667 30.0 10.0 70.0 False 0.0 8.0 2.0 0.0 1.0041 30.0 1.0 7.0 0.90349 3.0 21.0 3.0 67.0 45.0 1.0 5.0 0.0 3.0 pbl de deglutition a9ans(suce son pouce) False 3.0 True 3.0 0.98314 1.07017 False 50.0 False False 1.0 False 1.06529 n/a 10.0 30.0 20.0 70.0 70.0 80.0 d 20.0 70.0 2.0 True 0.0 True 2.0 False 3.0 False 0.0 0.830847 False False 1.0 20.0 14.0 1.14585 0.0 PHYSIONOMIE 5.0 3.0 60.0 0 n/a True 1.03714 True 1.0 2.5 0.142857 1.0 ESPECES VEGETALES 3.0 110.0 329 n/a 10.0 1.14439 6.59722 8.0 2.0 50.0 10.0 20.0 False True True False 5.0 True 20.0 0.841678 2.0 True +S73 40.0 0.927448 1.0 1.0 False -0.00182578 n/a False n/a 1.0 3.0 15.0 0.979823 1.90476 False False n/a 0.766667 3.2 300.0 0.0 8.4 False 12.2 8.0 0.916667 25.0 10.0 50.0 False 0.0 9.0 0.0 n/a 1.07666 60.0 n/a 10.0 0.977997 3.0 30.0 3.0 63.0 41.0 1.0 10.0 0.0 3.0 n/a n/a 2.0 True 4.0 0.994564 1.36044 False 70.0 False False n/a False 1.38042 n/a 10.0 30.0 20.0 70.0 80.0 110.0 n/a 18.0 90.0 4.0 False 0.0 True 3.0 False n/a False 2.0 0.979557 False False n/a 15.0 13.0 1.22344 n/a espece animal 7.6 0.0 60.0 n/a n/a False 1.0435 False 1.0 1.0 0.311475 1.0 visage 3.0 60.0 365 n/a n/a 1.22709 n/a 7.0 3.0 50.0 10.0 55.0 False True n/a False 3.0 False 16.0 0.929294 3.0 False +S74 30.0 0.382676 n/a n/a False -0.0665277 2.5 True 4.0 n/a 1.0 40.0 0.920906 1.66667 False True 1.0 0.8 3.6 250.0 n/a 9.0 False 12.0 12.0 0.833333 30.0 12.0 50.0 False 0.2 9.0 1.0 3.0 0.637316 20.0 1.0 10.0 0.854378 3.0 32.0 4.0 62.0 42.0 n/a 7.0 0.0 3.0 EXPRESSION ORALE False 4.0 True 5.0 0.999392 0.562843 False 30.0 False False 3.0 False 0.569578 n/a 15.0 30.0 20.0 50.0 50.0 50.0 U? 25.0 50.0 1.0 True 2.0 True 3.0 True 4.0 False 2.0 0.859567 False False 1.0 10.0 10.0 0.720039 3.5 lieux 6.0 2.0 60.0 0 n/a False 0.999466 True 0.0 0.0 0.25 1.0 Visages 5.0 50.0 207 n/a 11.0 0.726359 5.81944 4.0 5.0 50.0 10.0 30.0 False True True False 2.5 True 15.0 0.819761 3.0 False +S75 90.0 1.17674 1.0 1.0 False -0.0322937 1.5 False 4.0 1.0 1.0 30.0 0.962962 1.5 False False 1.0 0.966667 5.0 300.0 1.0 10.0 False 12.5 7.0 0.666667 40.0 10.0 80.0 False 0.2 10.0 0.0 5.0 1.06134 15.0 1.0 10.0 0.930669 3.0 32.0 4.0 64.0 43.0 1.0 10.0 0.0 3.0 0 False 3.0 True 3.0 0.999677 1.77613 False 40.0 False False 3.0 False 1.75148 n/a 20.0 50.0 30.0 80.0 120.0 150.0 u 25.0 100.0 3.0 False 0.0 True 1.0 False 5.0 False 2.0 0.843897 False False 0.0 7.0 10.0 1.2123 4.0 n/a 5.0 0.0 60.0 0 n/a False 1.00794 False 2.0 3.5 0.2 2.0 LIEUX VISAGES 3.0 60.0 319 n/a 7.0 1.20962 7.72222 6.0 5.0 70.0 13.0 120.0 False True True True 3.0 False 15.0 0.945441 2.0 False +S76 50.0 0.611865 n/a n/a False -0.0818007 3.5 False 4.0 n/a 1.0 20.0 0.921049 1.66667 False False 2.0 0.833333 2.6 500.0 n/a 9.0 False 12.0 7.0 0.25 30.0 10.0 35.0 False 0.0 10.0 0.0 3.0 0.873615 150.0 2.0 10.0 0.839249 3.0 33.0 4.0 66.0 45.0 n/a 6.0 0.0 3.0 0 False 4.0 True 3.0 0.999685 0.93416 False 200.0 False False 2.0 True 0.910705 n/a 10.0 30.0 20.0 40.0 70.0 90.0 u 20.0 50.0 3.0 False 0.0 True 3.0 False 3.0 False 2.0 0.825401 False True 1.0 50.0 15.0 1.0031 3.33333 0 6.0 0.0 30.0 Couleur / mots n/a False 1.02149 False 2.0 3.5 0.25 2.0 visages, lieux 3.0 200.0 172 n/a 17.0 0.995672 7.95833 6.0 3.0 65.0 10.0 100.0 False True False False 2.0 False 15.0 1.09488 3.0 False +S77 45.0 0.689299 n/a n/a False -0.0180914 1.0 False 5.0 n/a 2.0 10.0 0.968552 2.11111 True True 0.0 0.966667 3.0 500.0 n/a 9.0 False 14.0 11.0 0.416667 20.0 10.0 40.0 False 0.0 9.0 0.0 4.0 0.981267 15.0 1.0 10.0 0.950461 3.0 30.0 4.0 64.0 43.0 n/a 10.0 n/a 3.0 n/a False 4.0 True 3.0 0.999983 1.01458 False 500.0 False False 3.0 False 1.02596 n/a 10.0 30.0 20.0 70.0 60.0 80.0 u 15.0 70.0 2.0 False 1.0 True 3.0 False 5.0 False 2.0 0.671399 False False 1.0 7.0 10.0 1.11533 4.33333 lieux 10.0 3.0 60.0 0 n/a False 1.00274 False 1.0 0.0 0.357143 2.0 visage 4.0 700.0 115 n/a 6.0 1.11837 4.65972 5.0 4.0 80.0 15.0 20.0 False True True False 2.0 True 19.0 1.19359 2.0 False +S78 40.0 0.548867 n/a n/a False -0.0193456 3.0 False 4.0 n/a 2.0 25.0 0.950317 1.7 False False 2.0 0.7 3.8 600.0 n/a 10.0 False 13.5 15.0 0.916667 40.0 10.0 50.0 False 0.0 10.0 0.0 3.0 0.813199 60.0 1.0 10.0 0.930971 3.0 30.0 4.0 62.0 41.0 1.0 7.0 2.0 3.0 0 False 2.0 True 3.0 0.999859 0.815318 False 45.0 False False 2.0 False 0.816939 n/a 15.0 30.0 20.0 60.0 60.0 70.0 u 20.0 60.0 2.0 False 0.0 True 2.0 False 4.0 False 2.0 0.905331 False False 1.0 10.0 15.0 0.925195 2.0 n/a 7.0 0.0 50.0 0 n/a False 0.991229 False 1.0 2.5 0.259259 1.0 VISAGES 1.0 30.0 328 n/a 14.0 0.926816 6.74306 9.0 2.0 60.0 16.0 112.0 False True False False 3.0 False 17.0 0.960007 n/a False +S79 42.0 0.449873 n/a 0.0 False 0.00970278 4.0 False 3.0 n/a 1.0 12.0 0.905277 1.4 False False 2.0 0.566667 1.8 350.0 n/a 10.0 False 12.0 7.0 0.666667 28.0 16.0 30.0 False 0.25 9.0 0.0 1.0 0.603731 30.0 2.0 9.0 0.914979 3.0 27.0 4.0 68.0 45.0 n/a 6.0 0.0 3.0 0 False 4.0 True 1.0 0.997786 0.671734 False 100.0 False True 1.0 False 0.669595 n/a 18.0 28.0 21.0 50.0 59.0 63.0 d 22.0 55.0 3.0 False 0.0 True 3.0 True 5.0 False 1.0 0.917245 False False 1.0 20.0 12.0 0.693804 1.66667 Mettre nom sur un visage 4.0 0.0 70.0 Chiffres ds espace n/a False 1.01049 False 1.0 3.5 0.166667 3.0 tout 1.0 80.0 198 n/a 18.0 0.688082 8.22222 4.0 1.0 50.0 12.0 100.0 False False False False 2.0 False 14.0 1.03246 3.0 False +S80 48.0 0.634019 n/a n/a False -0.00810036 2.5 False 4.0 n/a 2.0 30.0 0.948885 1.5 False True 1.0 0.733333 2.6 530.0 n/a 10.0 False 12.5 13.0 0.5 31.0 8.0 41.0 False 0.0 7.0 0.0 2.0 0.91701 250.0 0.0 10.0 0.940784 3.0 25.0 4.0 62.0 43.0 n/a 10.0 0.0 3.0 0 False 3.0 True 3.0 0.996996 0.946805 False 20.0 False False 2.0 False 0.94368 n/a 12.0 35.0 34.0 56.0 68.0 86.0 u 19.0 63.0 2.0 False 1.0 True 1.0 False 5.0 False 2.0 0.798489 False False 1.0 6.0 18.0 1.03757 3.33333 0 5.0 0.0 62.0 0 n/a False 0.982516 False 2.0 2.0 0.2 1.0 visages, lieux 3.0 45.0 180 n/a 9.0 1.04513 6.375 8.0 3.0 75.0 10.0 50.0 False True True False 3.0 False 15.0 0.987773 3.0 False +S81 n/a n/a n/a n/a False n/a n/a False n/a n/a n/a 15.0 n/a n/a n/a n/a n/a n/a n/a 500.0 n/a n/a False n/a 8.0 n/a n/a n/a n/a False n/a n/a n/a n/a n/a 40.0 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a False 40.0 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a 1.0 0.979913 False n/a n/a 10.0 15.0 n/a n/a n/a n/a n/a 55.0 n/a n/a n/a n/a n/a 1.0 n/a n/a n/a n/a n/a 50.0 217 n/a n/a n/a n/a n/a n/a 90.0 n/a 60.0 n/a n/a n/a n/a 3.0 n/a n/a 1.00486 n/a False +S82 55.0 0.611077 n/a n/a False -0.0475203 3.5 False 3.0 n/a 1.0 15.0 0.963192 2.0 True True 1.0 0.85 2.4 1000.0 n/a 10.0 False 15.0 8.0 0.583333 25.0 11.0 45.0 False 0.33 10.0 0.0 3.0 0.877608 15.0 2.0 10.0 0.915672 3.0 30.0 3.0 66.0 43.0 n/a 7.0 0.0 1.0 0 False 3.0 True 3.0 0.994773 0.92664 False 25.0 False False 2.0 False 0.909533 n/a 12.0 30.0 20.0 50.0 68.0 80.0 u 17.0 55.0 2.0 False 0.0 True 2.0 False 4.0 False 2.0 0.745845 False False 1.0 8.0 12.0 1.0073 3.0 lieux 10.0 2.0 50.0 0 n/a False 1.05757 False 0.0 2.0 0.333333 2.0 Visages 3.0 20.0 195 n/a 15.0 1.00022 5.27778 4.0 4.0 50.0 13.0 6.0 False True False False 2.0 False 20.0 1.00696 2.0 False +S83 55.0 0.752174 n/a n/a False -0.0102645 3.0 False 3.0 n/a 1.0 7.0 0.983114 1.25 False True 1.0 1.0 3.4 600.0 n/a 12.0 False 13.5 8.0 0.75 30.0 10.0 60.0 False 0.0 10.0 0.0 3.0 0.946814 15.0 2.0 10.0 0.972849 3.0 35.0 3.0 65.0 43.0 n/a 10.0 0.0 3.0 0 False 3.0 True 4.0 0.992436 1.10866 False 100.0 False False 3.0 False 1.11954 n/a 13.0 40.0 25.0 75.0 70.0 90.0 d 25.0 80.0 4.0 False 0.0 True 1.0 False 4.0 False 2.0 0.777745 False False 1.0 8.0 12.0 1.07195 2.66667 lieux 3.0 0.0 50.0 0 n/a False 1.06735 False 0.0 1.0 0.111111 3.0 Visages 4.0 30.0 184 n/a 14.0 1.0791 6.4375 5.0 4.0 60.0 11.0 50.0 False True False False 8.0 False 15.0 0.904109 3.0 False +S84 70.0 0.918418 n/a n/a False 0.053325 1.0 False 4.0 n/a 1.0 7.0 0.888236 1.54545 False False 1.0 0.8 3.4 450.0 n/a 11.0 False 14.0 11.0 0.75 40.0 12.0 75.0 False 0.25 10.0 0.0 3.0 1.15816 80.0 1.0 10.0 0.941561 3.0 33.0 5.0 63.0 42.0 n/a 9.0 0.0 3.0 0 False 4.0 True 3.0 0.995588 1.37754 False 70.0 False False 3.0 False 1.36698 n/a 5.0 40.0 35.0 70.0 95.0 110.0 d 20.0 85.0 4.0 False 0.0 True 0.0 False 4.0 False 2.0 0.818761 False False 1.0 5.0 14.0 1.3146 3.33333 0 6.0 0.0 45.0 0 n/a False 0.966338 False 2.0 2.5 0.214286 2.0 visages, lieux 3.0 25.0 193 n/a 8.0 1.31998 7.10417 5.0 3.0 60.0 10.0 9.0 False True True False 1.5 False 17.0 1.05465 2.0 False +S85 25.0 0.278677 n/a n/a False -0.022051 3.0 False 4.0 n/a 2.0 20.0 0.94183 2.0 False False 1.0 0.6 4.0 500.0 0.0 9.0 False 13.5 9.0 0.833333 25.0 10.0 30.0 False 0.33 8.0 0.0 2.0 0.562786 60.0 2.0 9.0 0.919779 3.0 30.0 5.0 60.0 40.0 n/a 9.0 0.0 3.0 0 False 3.0 True 3.0 0.995747 0.400515 False 80.0 False False 2.0 False 0.414786 n/a 15.0 25.0 20.0 30.0 35.0 40.0 u 15.0 45.0 4.0 False 0.0 True 3.0 False 4.0 False 2.0 0.962147 False False 1.0 10.0 12.0 0.631332 3.0 animaux 9.0 0.0 65.0 0 n/a False 0.944038 False 1.0 n/a 0.333333 2.0 Visages 3.0 50.0 169 n/a 14.0 0.641416 5.56944 6.0 4.0 60.0 13.0 30.0 False True n/a False 2.0 False 18.0 1.04717 4.0 False +S86 40.0 0.780401 1.0 1.0 False -0.0458562 1.5 False 4.0 1.0 1.0 50.0 0.878883 1.75 False True 0.0 0.5 3.4 750.0 1.0 10.0 False 13.75 9.0 0.416667 40.0 12.0 90.0 True 0.0 9.0 3.0 3.0 0.993049 90.0 2.0 10.0 0.833027 3.0 32.0 4.0 63.0 45.0 1.0 6.0 0.0 3.0 dyslexie, confusion che/jeu, f/v False 4.0 True 4.0 0.999649 1.14484 True 30.0 False False 2.0 False 1.16156 n/a 10.0 20.0 28.0 70.0 65.0 90.0 u 15.0 80.0 4.0 True 0.0 True 2.0 True 4.0 True 1.0 0.89167 False False 1.0 12.0 11.0 1.13006 0.0 n/a 7.5 0.0 60.0 0 n/a False 1.01092 True 1.0 1.5 0.272727 1.0 n/a 2.0 80.0 346 n/a 9.0 1.13179 6.26389 6.0 4.0 70.0 13.0 30.0 False True n/a True 2.5 False 17.5 1.04276 3.0 False +S87 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a 369 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a +S88 45.0 0.525943 n/a 0.0 False -0.0442923 0.0 False 4.0 n/a 1.0 35.0 0.958444 1.875 False False 0.0 0.6 3.6 500.0 n/a 8.0 True 11.5 10.0 0.75 25.0 10.0 40.0 False 0.5 8.0 2.0 2.0 0.825556 60.0 1.0 10.0 0.914152 3.0 32.0 5.0 60.0 42.0 n/a 8.0 0.0 3.0 APPRENTISSAGE LECTURE, math False 3.0 True 3.0 0.995658 0.77895 False 100.0 True True 1.0 False 0.782818 n/a 15.0 35.0 20.0 60.0 60.0 60.0 d 15.0 60.0 3.0 True 1.0 True 0.0 False 3.0 False 2.0 0.860257 False True 0.0 20.0 15.0 0.93793 2.33333 noms 7.0 0.0 60.0 nombre / espace, gouts et sons n/a False 0.955381 True 2.0 3.0 0.304348 1.0 visages, lieux 1.0 150.0 178 n/a 2.0 0.940899 7.375 4.0 1.0 80.0 10.0 400.0 False True True False 3.0 False 15.0 1.05283 2.0 False +S89 70.0 1.09973 n/a n/a False -0.0425949 1.0 False 5.0 n/a 3.0 40.0 0.927972 2.55556 False True 0.0 0.666667 3.0 200.0 n/a 9.0 False 16.0 20.0 0.583333 40.0 11.0 60.0 False 0.0 10.0 0.0 3.0 1.01285 150.0 0.0 10.0 0.885377 3.0 24.0 3.0 62.0 38.0 n/a 7.0 0.0 2.0 0 True 4.0 True 3.0 0.992471 1.64304 False 40.0 False False 3.0 False 1.63685 n/a 15.0 30.0 25.0 50.0 100.0 150.0 d 25.0 100.0 2.0 False 0.0 True 1.0 False 5.0 False 2.0 0.00909366 False True 0.0 15.0 10.0 1.16136 4.0 LIEUX 14.0 0.0 5.0 0 n/a False 1.01316 False 0.0 0.0 0.4375 1.0 VISAGE 5.0 1000.0 289 n/a 2.0 1.15436 3.38194 9.0 3.0 50.0 18.0 300.0 False True True False 1000.0 False 23.0 0.126279 2.0 False +S90 80.0 1.19538 n/a n/a False -0.00869327 3.0 False 2.0 n/a 3.0 15.0 0.894658 1.71429 False False 2.0 0.7 2.8 400.0 n/a 7.0 False 9.5 7.0 0.666667 60.0 10.0 40.0 False 0.33 10.0 1.0 1.0 1.11558 20.0 2.0 10.0 0.885965 3.0 22.0 5.0 62.0 45.0 n/a 7.0 0.0 3.0 en histoire False 4.0 True 2.0 0.983444 1.75143 False 30.0 True False 1.0 False 1.77922 n/a 15.0 60.0 30.0 80.0 100.0 150.0 d 15.0 130.0 2.0 True 1.0 True 0.0 False 4.0 False 1.0 0.905508 False False 1.0 8.0 10.0 1.26396 1.66667 lieux 5.0 0.0 60.0 n/a n/a False 0.939536 False 0.0 1.5 0.263158 1.0 0 3.0 20.0 213 n/a 16.0 1.27144 5.84722 10.0 2.0 80.0 10.0 30.0 False True True False 2.5 False 12.0 0.953995 2.0 False +S91 50.0 0.611427 1.0 1.0 False -0.00681096 3.5 False 3.0 1.0 2.0 20.0 0.966239 1.6 False False 2.0 0.9 4.2 500.0 1.0 10.0 False 13.0 7.0 0.833333 20.0 10.0 50.0 False 0.0 10.0 0.0 3.0 0.920033 40.0 2.0 10.0 0.959428 3.0 23.0 5.0 61.0 43.0 1.0 10.0 0.0 3.0 deglutition a 15ans pendant 4mois False 4.0 True 4.0 0.987777 0.899697 False 120.0 False False 2.0 False 0.910054 n/a 10.0 30.0 20.0 50.0 60.0 70.0 u 20.0 70.0 2.0 False 0.0 True 1.0 False 4.0 False 1.0 n/a False False 1.0 15.0 10.0 1.04483 2.0 n/a 6.0 0.0 60.0 0 n/a False 0.934578 True 2.0 3.0 0.230769 2.0 LIEUX 4.0 60.0 334 n/a 17.0 1.04858 8.25694 7.0 3.0 n/a 10.0 140.0 False True False True 2.0 False 16.0 n/a 4.0 False +S92 38.0 0.475912 n/a n/a False -0.0850252 1.5 False 5.0 n/a 1.0 6.0 0.785702 1.44444 False True 1.0 0.8 3.2 500.0 n/a 9.0 False 11.0 9.0 0.75 25.0 12.0 29.0 False 0.0 10.0 0.0 3.0 0.696258 120.0 1.0 9.0 0.700677 3.0 32.0 5.0 65.0 43.0 n/a 8.0 2.0 3.0 0 False 4.0 True 4.0 0.99624 0.744678 False 200.0 False False 3.0 False 0.708352 n/a 15.0 25.0 24.0 44.0 66.0 77.0 u 12.0 29.0 4.0 False 0.0 True n/a False 5.0 False 1.0 0.815552 False True 1.0 15.0 12.0 0.810939 3.66667 0 4.0 0.0 52.0 Suites ds espaCe et couleurs n/a False 0.972245 False 1.0 2.0 0.181818 2.0 0 5.0 20.0 196 n/a 9.0 0.793536 6.95833 6.0 5.0 80.0 10.0 50.0 False True False False 3.0 False 13.0 1.04952 3.0 False +S93 50.0 0.717351 n/a 0.0 False -0.0384674 3.5 False 3.0 n/a 1.0 20.0 0.959921 2.08333 False False 1.0 1.0 4.8 280.0 n/a 12.0 False 18.5 8.0 0.916667 40.0 12.0 70.0 False 0.0 10.0 0.0 3.0 0.856346 30.0 1.0 10.0 0.921454 3.0 35.0 4.0 60.0 43.0 n/a 10.0 0.0 3.0 0 False 3.0 True 4.0 0.997048 1.0501 False 30.0 False False 3.0 False 1.06771 n/a 15.0 40.0 30.0 50.0 60.0 100.0 d 20.0 80.0 4.0 False 0.0 True 1.0 False 4.0 False 1.0 0.907422 False False 1.0 10.0 12.0 0.967146 3.0 NOMS 13.0 0.0 50.0 NUM DE TELEPHONE n/a False 1.00396 False 2.0 3.0 0.351351 1.0 LIEUX CHIFFRES 4.0 120.0 343 n/a 13.0 0.975992 8.03472 5.0 5.0 50.0 12.0 100.0 False True n/a False 2.0 False 25.0 0.980029 2.0 False +S94 53.0 0.913518 n/a n/a False -0.0127455 4.0 False 3.0 n/a 1.0 17.0 0.992355 2.1 False False 1.0 0.9 4.7 250.0 n/a 10.0 False 15.5 6.5 1.0 30.0 10.0 60.0 False 0.0 9.0 0.0 3.0 1.03356 50.0 2.0 10.0 0.97961 3.0 36.0 5.0 64.0 43.0 n/a 9.0 0.0 3.0 0 False 1.0 True 5.0 0.994238 1.35131 False 65.0 False False 3.0 False 1.35969 n/a 13.0 38.0 25.0 60.0 90.0 110.0 d 18.0 90.0 4.0 False 0.0 True 5.0 False 4.0 False 1.0 0.937513 False False 1.0 15.0 15.0 1.17454 3.33333 0 11.0 0.0 50.0 nombre / espace n/a False 0.979051 False 1.0 4.0 0.354839 3.0 0 4.0 55.0 189 n/a 16.0 1.17797 9.66667 4.0 4.0 60.0 10.0 120.0 False True n/a False 2.75 False 21.0 0.933082 4.0 False diff --git a/nilearn/datasets/tests/data/localizer_index.json b/nilearn/datasets/tests/data/localizer_index.json new file mode 100755 index 0000000000..2d0bb9fb2f --- /dev/null +++ b/nilearn/datasets/tests/data/localizer_index.json @@ -0,0 +1,114 @@ +[ + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_mask.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_spm.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualCalculationVsSentences_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualCalculationVsSentences_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualCalculationVsSentences_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualCalculation_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualCalculation_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualCalculation_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualMotorVsCognitiveProcessing_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualMotorVsCognitiveProcessing_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualMotorVsCognitiveProcessing_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualSentences_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualSentences_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Auditory&VisualSentences_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryCalculationVsAuditorySentences_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryCalculationVsAuditorySentences_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryCalculationVsAuditorySentences_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryCalculation_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryCalculation_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryCalculation_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryClickVsAuditorySentences_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryClickVsAuditorySentences_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryClickVsAuditorySentences_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryProcessingVsVisualProcessing_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryProcessingVsVisualProcessing_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryProcessingVsVisualProcessing_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryProcessing_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryProcessing_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditoryProcessing_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditorySentences_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditorySentences_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-AuditorySentences_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Checkerboard_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Checkerboard_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Checkerboard_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-CognitiveProcessingVsMotor_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-CognitiveProcessingVsMotor_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-CognitiveProcessingVsMotor_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-EffectsOfInterest_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-EffectsOfInterest_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-EffectsOfInterest_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-HorizontalCheckerboard_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-HorizontalCheckerboard_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-HorizontalCheckerboard_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-HorizontalVsVerticalCheckerboard_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-HorizontalVsVerticalCheckerboard_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-HorizontalVsVerticalCheckerboard_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftAuditory&VisualClickVsRightAuditory&VisualClick_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftAuditory&VisualClickVsRightAuditory&VisualClick_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftAuditory&VisualClickVsRightAuditory&VisualClick_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftAuditory&VisualClick_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftAuditory&VisualClick_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftAuditory&VisualClick_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftAuditoryClick_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftAuditoryClick_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftAuditoryClick_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftVisualClick_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftVisualClick_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-LeftVisualClick_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Motor_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Motor_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-Motor_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightAuditory&VisualClickVsLeftAuditory&VisualClick_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightAuditory&VisualClickVsLeftAuditory&VisualClick_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightAuditory&VisualClickVsLeftAuditory&VisualClick_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightAuditory&VisualClick_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightAuditory&VisualClick_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightAuditory&VisualClick_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightAuditoryClick_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightAuditoryClick_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightAuditoryClick_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightVisualClick_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightVisualClick_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-RightVisualClick_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VerticalCheckerboard_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VerticalCheckerboard_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VerticalCheckerboard_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VerticalVsHorizontalCheckerboard_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VerticalVsHorizontalCheckerboard_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VerticalVsHorizontalCheckerboard_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualCalculationVsSentences_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualCalculationVsSentences_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualCalculationVsSentences_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualCalculation_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualCalculation_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualCalculation_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualClickVsVisualSentences_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualClickVsVisualSentences_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualClickVsVisualSentences_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualProcessingVsAuditoryProcessing_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualProcessingVsAuditoryProcessing_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualProcessingVsAuditoryProcessing_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualProcessingVsCheckerboard_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualProcessingVsCheckerboard_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualProcessingVsCheckerboard_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualProcessing_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualProcessing_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualProcessing_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualSentencesVsCheckerboard_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualSentencesVsCheckerboard_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualSentencesVsCheckerboard_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualSentences_cmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualSentences_contrasts.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_acq-VisualSentences_tmaps.nii.gz", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_design.json", + "/localizer/derivatives/spm_1st_level/sub-{0}/sub-{0}_task-localizer_design.npy", + "/localizer/derivatives/spm_preprocessing/sub-{0}/sub-{0}_T1w.nii.gz", + "/localizer/derivatives/spm_preprocessing/sub-{0}/sub-{0}_task-localizer_bold.nii.gz", + "/localizer/sub-{0}/anat/sub-{0}_T1w.nii.gz", + "/localizer/sub-{0}/func/sub-{0}_task-localizer_bold.json", + "/localizer/sub-{0}/func/sub-{0}_task-localizer_bold.nii.gz" +] + diff --git a/nilearn/datasets/tests/data/localizer_participants.tsv b/nilearn/datasets/tests/data/localizer_participants.tsv new file mode 100644 index 0000000000..a029d440d6 --- /dev/null +++ b/nilearn/datasets/tests/data/localizer_participants.tsv @@ -0,0 +1,95 @@ +participant_id age sex site family language +S01 24 M SHFJ F01 French +S02 20 M SHFJ F02 French +S03 22 F SHFJ F03 French +S04 20 M Neurospin F04 French +S05 23 F Neurospin F05 French +S06 19 M Neurospin F06 French +S07 26 F Neurospin F07 French +S08 27 M Neurospin F89 French +S09 21 F Neurospin F09 French +S10 24 F SHFJ F10 French +S11 47 F SHFJ F11 French +S12 23 F SHFJ F12 French +S13 19 M Neurospin F13 French +S14 21 F SHFJ F14 French +S15 22 F SHFJ F15 French +S16 24 F SHFJ F16 French +S17 22 M SHFJ F17 French +S18 20 F Neurospin F18 French +S19 18 M SHFJ F52 French +S20 25 F SHFJ F20 French +S21 21 M SHFJ F21 French +S22 40 M SHFJ F22 French +S23 24 F Neurospin F23 French +S24 18 F Neurospin F24 French +S25 24 F SHFJ F25 French +S26 24 F Neurospin F26 French +S27 30 M Neurospin F27 French +S28 18 F Neurospin F28 French +S29 21 F Neurospin F29 French +S30 34 F SHFJ F30 French +S31 22 F Neurospin F31 French +S32 26 F SHFJ F32 French +S33 21 F SHFJ F33 French +S34 21 M SHFJ F34 French +S35 24 F SHFJ F35 French +S36 25 F SHFJ F36 French +S37 22 M Neurospin F37 French +S38 n/a M SHFJ F38 French +S39 22 M SHFJ F39 French +S40 24 F SHFJ F40 French +S41 18 M Neurospin F41 French +S42 26 M Neurospin F42 French +S43 49 M Neurospin F43 French +S44 34 F SHFJ F44 French +S45 21 M SHFJ F45 French +S46 24 F Neurospin F46 French +S47 19 M SHFJ F47 French +S48 21 F SHFJ F48 French +S49 22 F SHFJ F49 French +S50 32 F SHFJ F50 French +S51 30 M SHFJ F51 French +S52 22 F SHFJ F52 French +S53 18 F Neurospin F53 French +S54 20 F SHFJ F54 French +S55 21 F Neurospin F55 French +S56 23 M Neurospin F56 French +S57 20 F SHFJ F57 French +S58 34 M SHFJ F58 French +S59 30 M SHFJ F59 French +S60 21 M Neurospin F60 French +S61 23 M SHFJ F61 French +S62 n/a F SHFJ F62 French +S63 19 F Neurospin F63 French +S64 21 F Neurospin F64 French +S65 19 M Neurospin F65 French +S66 26 M Neurospin F66 French +S67 44 F SHFJ F67 French +S68 20 M SHFJ F68 French +S69 21 F SHFJ F69 French +S70 25 M SHFJ F59 French +S71 21 M SHFJ F71 French +S72 37 F Neurospin F72 French +S73 19 M Neurospin F73 French +S74 21 M SHFJ F74 French +S75 20 M Neurospin F75 French +S76 28 F SHFJ F76 French +S77 23 F SHFJ F77 French +S78 29 M Neurospin F78 French +S79 43 F SHFJ F79 French +S80 19 F SHFJ F80 French +S81 n/a M SHFJ F81 French +S82 20 F SHFJ F82 French +S83 20 F Neurospin F83 French +S84 23 F SHFJ F84 French +S85 21 M SHFJ F85 French +S86 31 M Neurospin F86 French +S87 n/a M SHFJ F87 French +S88 19 M SHFJ F88 French +S89 29 M Neurospin F89 French +S90 21 M SHFJ F90 French +S91 23 M Neurospin F91 French +S92 26 F SHFJ F92 French +S93 36 M Neurospin F93 French +S94 41 M SHFJ F94 French diff --git a/nilearn/datasets/tests/test_atlas.py b/nilearn/datasets/tests/test_atlas.py index e6984c4d6c..a2ce5b8cf1 100644 --- a/nilearn/datasets/tests/test_atlas.py +++ b/nilearn/datasets/tests/test_atlas.py @@ -565,7 +565,7 @@ def test_fetch_atlas_pauli_2017(): @with_setup(tst.setup_tmpdata, tst.teardown_tmpdata) def test_fetch_atlas_schaefer_2018(): - valid_n_rois = [100, 200, 300, 400, 500, 600, 800, 1000] + valid_n_rois = list(range(100, 1100, 100)) valid_yeo_networks = [7, 17] valid_resolution_mm = [1, 2] diff --git a/nilearn/datasets/tests/test_func.py b/nilearn/datasets/tests/test_func.py index 27193e9ac0..9c52e3dbca 100644 --- a/nilearn/datasets/tests/test_func.py +++ b/nilearn/datasets/tests/test_func.py @@ -5,6 +5,7 @@ # License: simplified BSD import os +import uuid import numpy as np import json import nibabel @@ -12,7 +13,8 @@ from sklearn.utils import check_random_state from nose import with_setup -from nose.tools import assert_true, assert_equal, assert_not_equal +from nose.tools import ( + assert_true, assert_false, assert_equal, assert_not_equal) from . import test_utils as tst from nilearn.datasets import utils, func @@ -146,193 +148,145 @@ def test_miyawaki2008(): assert_not_equal(dataset.description, '') +with open(os.path.join(tst.datadir, 'localizer_index.json')) as of: + localizer_template = json.load(of) +LOCALIZER_INDEX = {} +for idx in range(1, 95): + idx = str(idx).zfill(2) + sid = 'S{0}'.format(idx) + LOCALIZER_INDEX.update(dict( + (key.format(sid), uuid.uuid4().hex) + for key in localizer_template)) +LOCALIZER_INDEX['/localizer/phenotype/behavioural.tsv'] = uuid.uuid4().hex +LOCALIZER_PARTICIPANTS = np.recfromcsv( + os.path.join(tst.datadir, 'localizer_participants.tsv'), delimiter='\t') +LOCALIZER_BEHAVIOURAL = np.recfromcsv( + os.path.join(tst.datadir, 'localizer_behavioural.tsv'), delimiter='\t') + + +def mock_localizer_index(*args, **kwargs): + return LOCALIZER_INDEX + + +def mock_np_recfromcsv(*args, **kwargs): + if args[0].endswith('participants.tsv'): + return LOCALIZER_PARTICIPANTS + elif args[0].endswith('behavioural.tsv'): + return LOCALIZER_BEHAVIOURAL + else: + raise ValueError('Unexpected args!') + + +def setup_localizer(): + global original_json_load + global mock_json_load + mock_json_load = mock_localizer_index + original_json_load = json.load + json.load = mock_json_load + + global original_np_recfromcsv + global mock_np_recfromcsv + mock_np_recfromcsv = mock_np_recfromcsv + original_np_recfromcsv = np.recfromcsv + np.recfromcsv = mock_np_recfromcsv + + +def teardown_localizer(): + global original_json_load + json.load = original_json_load + + global original_np_recfromcsv + np.recfromcsv = original_np_recfromcsv + + @with_setup(setup_mock, teardown_mock) @with_setup(tst.setup_tmpdata, tst.teardown_tmpdata) +@with_setup(setup_localizer, teardown_localizer) def test_fetch_localizer_contrasts(): - local_url = "file://" + tst.datadir - ids = np.asarray([('S%2d' % i).encode() for i in range(94)]) - ids = ids.view(dtype=[('subject_id', 'S3')]) - tst.mock_fetch_files.add_csv('cubicwebexport.csv', ids) - tst.mock_fetch_files.add_csv('cubicwebexport2.csv', ids) - - # Disabled: cannot be tested without actually fetching covariates CSV file - # All subjects - dataset = func.fetch_localizer_contrasts(["checkerboard"], - data_dir=tst.tmpdir, - url=local_url, - verbose=0) - assert_true(dataset.anats is None) - assert_true(dataset.tmaps is None) - assert_true(dataset.masks is None) - assert_true(isinstance(dataset.ext_vars, np.recarray)) - assert_true(isinstance(dataset.cmaps[0], _basestring)) - assert_equal(dataset.ext_vars.size, 94) - assert_equal(len(dataset.cmaps), 94) - - # 20 subjects - dataset = func.fetch_localizer_contrasts(["checkerboard"], - n_subjects=20, - data_dir=tst.tmpdir, - url=local_url, - verbose=0) - assert_true(dataset.anats is None) - assert_true(dataset.tmaps is None) - assert_true(dataset.masks is None) + # 2 subjects + dataset = func.fetch_localizer_contrasts( + ['checkerboard'], + n_subjects=2, + data_dir=tst.tmpdir, + verbose=1) + assert_false(hasattr(dataset, 'anats')) + assert_false(hasattr(dataset, 'tmaps')) + assert_false(hasattr(dataset, 'masks')) assert_true(isinstance(dataset.cmaps[0], _basestring)) assert_true(isinstance(dataset.ext_vars, np.recarray)) - assert_equal(len(dataset.cmaps), 20) - assert_equal(dataset.ext_vars.size, 20) + assert_equal(len(dataset.cmaps), 2) + assert_equal(dataset.ext_vars.size, 2) # Multiple contrasts dataset = func.fetch_localizer_contrasts( - ["checkerboard", "horizontal checkerboard"], - n_subjects=20, data_dir=tst.tmpdir, - verbose=0) - assert_true(dataset.anats is None) - assert_true(dataset.tmaps is None) - assert_true(dataset.masks is None) + ['checkerboard', 'horizontal checkerboard'], + n_subjects=2, + data_dir=tst.tmpdir, + verbose=1) assert_true(isinstance(dataset.ext_vars, np.recarray)) assert_true(isinstance(dataset.cmaps[0], _basestring)) - assert_equal(len(dataset.cmaps), 20 * 2) # two contrasts are fetched - assert_equal(dataset.ext_vars.size, 20) - - # get_anats=True - dataset = func.fetch_localizer_contrasts(["checkerboard"], - data_dir=tst.tmpdir, - url=local_url, - get_anats=True, - verbose=0) - assert_true(dataset.masks is None) - assert_true(dataset.tmaps is None) - assert_true(isinstance(dataset.ext_vars, np.recarray)) - assert_true(isinstance(dataset.anats[0], _basestring)) - assert_true(isinstance(dataset.cmaps[0], _basestring)) - assert_equal(dataset.ext_vars.size, 94) - assert_equal(len(dataset.anats), 94) - assert_equal(len(dataset.cmaps), 94) - - # get_masks=True - dataset = func.fetch_localizer_contrasts(["checkerboard"], - data_dir=tst.tmpdir, - url=local_url, - get_masks=True, - verbose=0) - assert_true(dataset.anats is None) - assert_true(dataset.tmaps is None) - assert_true(isinstance(dataset.ext_vars, np.recarray)) - assert_true(isinstance(dataset.cmaps[0], _basestring)) - assert_true(isinstance(dataset.masks[0], _basestring)) - assert_equal(dataset.ext_vars.size, 94) - assert_equal(len(dataset.cmaps), 94) - assert_equal(len(dataset.masks), 94) - - # get_tmaps=True - dataset = func.fetch_localizer_contrasts(["checkerboard"], - data_dir=tst.tmpdir, - url=local_url, - get_tmaps=True, - verbose=0) - assert_true(dataset.anats is None) - assert_true(dataset.masks is None) - assert_true(isinstance(dataset.ext_vars, np.recarray)) - assert_true(isinstance(dataset.cmaps[0], _basestring)) - assert_true(isinstance(dataset.tmaps[0], _basestring)) - assert_equal(dataset.ext_vars.size, 94) - assert_equal(len(dataset.cmaps), 94) - assert_equal(len(dataset.tmaps), 94) + assert_equal(len(dataset.cmaps), 2 * 2) # two contrasts are fetched + assert_equal(dataset.ext_vars.size, 2) # all get_*=True - dataset = func.fetch_localizer_contrasts(["checkerboard"], - data_dir=tst.tmpdir, - url=local_url, - get_anats=True, - get_masks=True, - get_tmaps=True, - verbose=0) - + dataset = func.fetch_localizer_contrasts( + ['checkerboard'], + n_subjects=1, + data_dir=tst.tmpdir, + get_anats=True, + get_masks=True, + get_tmaps=True, + verbose=1) assert_true(isinstance(dataset.ext_vars, np.recarray)) assert_true(isinstance(dataset.anats[0], _basestring)) assert_true(isinstance(dataset.cmaps[0], _basestring)) assert_true(isinstance(dataset.masks[0], _basestring)) assert_true(isinstance(dataset.tmaps[0], _basestring)) - assert_equal(dataset.ext_vars.size, 94) - assert_equal(len(dataset.anats), 94) - assert_equal(len(dataset.cmaps), 94) - assert_equal(len(dataset.masks), 94) - assert_equal(len(dataset.tmaps), 94) + assert_equal(dataset.ext_vars.size, 1) + assert_equal(len(dataset.anats), 1) + assert_equal(len(dataset.cmaps), 1) + assert_equal(len(dataset.masks), 1) + assert_equal(len(dataset.tmaps), 1) assert_not_equal(dataset.description, '') # grab a given list of subjects - dataset2 = func.fetch_localizer_contrasts(["checkerboard"], - n_subjects=[2, 3, 5], - data_dir=tst.tmpdir, - url=local_url, - get_anats=True, - get_masks=True, - get_tmaps=True, - verbose=0) - - # Check that we are getting only 3 subjects + dataset2 = func.fetch_localizer_contrasts( + ['checkerboard'], + n_subjects=[2, 3, 5], + data_dir=tst.tmpdir, + verbose=1) assert_equal(dataset2.ext_vars.size, 3) - assert_equal(len(dataset2.anats), 3) assert_equal(len(dataset2.cmaps), 3) - assert_equal(len(dataset2.masks), 3) - assert_equal(len(dataset2.tmaps), 3) - np.testing.assert_array_equal(dataset2.ext_vars, - dataset.ext_vars[[1, 2, 4]]) - np.testing.assert_array_equal(dataset2.anats, - np.array(dataset.anats)[[1, 2, 4]]) - np.testing.assert_array_equal(dataset2.cmaps, - np.array(dataset.cmaps)[[1, 2, 4]]) - np.testing.assert_array_equal(dataset2.masks, - np.array(dataset.masks)[[1, 2, 4]]) - np.testing.assert_array_equal(dataset2.tmaps, - np.array(dataset.tmaps)[[1, 2, 4]]) + assert_equal([row[0] for row in dataset2.ext_vars], + [b'S02', b'S03', b'S05']) @with_setup(setup_mock, teardown_mock) @with_setup(tst.setup_tmpdata, tst.teardown_tmpdata) +@with_setup(setup_localizer, teardown_localizer) def test_fetch_localizer_calculation_task(): - local_url = "file://" + tst.datadir - ids = np.asarray(['S%2d' % i for i in range(94)]) - ids = ids.view(dtype=[('subject_id', 'S3')]) - tst.mock_fetch_files.add_csv('cubicwebexport.csv', ids) - tst.mock_fetch_files.add_csv('cubicwebexport2.csv', ids) - - # Disabled: cannot be tested without actually fetching covariates CSV file - # All subjects - dataset = func.fetch_localizer_calculation_task(data_dir=tst.tmpdir, - url=local_url, - verbose=0) - assert_true(isinstance(dataset.ext_vars, np.recarray)) - assert_true(isinstance(dataset.cmaps[0], _basestring)) - assert_equal(dataset.ext_vars.size, 1) - assert_equal(len(dataset.cmaps), 1) - - # 20 subjects - dataset = func.fetch_localizer_calculation_task(n_subjects=20, - data_dir=tst.tmpdir, - url=local_url, - verbose=0) + # 2 subjects + dataset = func.fetch_localizer_calculation_task( + n_subjects=2, + data_dir=tst.tmpdir, + verbose=1) assert_true(isinstance(dataset.ext_vars, np.recarray)) assert_true(isinstance(dataset.cmaps[0], _basestring)) - assert_equal(dataset.ext_vars.size, 20) - assert_equal(len(dataset.cmaps), 20) + assert_equal(dataset.ext_vars.size, 2) + assert_equal(len(dataset.cmaps), 2) assert_not_equal(dataset.description, '') @with_setup(setup_mock, teardown_mock) @with_setup(tst.setup_tmpdata, tst.teardown_tmpdata) +@with_setup(setup_localizer, teardown_localizer) def test_fetch_localizer_button_task(): - local_url = "file://" + tst.datadir - - # Disabled: cannot be tested without actually fetching covariates CSV file - # Only one subject - dataset = func.fetch_localizer_button_task(data_dir=tst.tmpdir, - url=local_url, - verbose=0) - assert_true(isinstance(dataset.tmap, _basestring)) - assert_true(isinstance(dataset.anat, _basestring)) + # 2 subjects + dataset = func.fetch_localizer_button_task( + data_dir=tst.tmpdir, + verbose=1) + assert_true(isinstance(dataset.tmaps[0], _basestring)) + assert_true(isinstance(dataset.anats[0], _basestring)) assert_not_equal(dataset.description, '') diff --git a/nilearn/datasets/utils.py b/nilearn/datasets/utils.py index 446cae359e..d9aade43fa 100644 --- a/nilearn/datasets/utils.py +++ b/nilearn/datasets/utils.py @@ -336,9 +336,13 @@ def _uncompress_file(file_, delete_archive=True, verbose=1): processed = True elif ext == '.gz' or header.startswith(b'\x1f\x8b'): import gzip - gz = gzip.open(file_) if ext == '.tgz': filename = filename + '.tar' + elif ext == '': + # For gzip file, we rely on the assumption that there is an extenstion + shutil.move(file_, file_ + '.gz') + file_ = file_ + '.gz' + gz = gzip.open(file_) out = open(filename, 'wb') shutil.copyfileobj(gz, out, 8192) gz.close() diff --git a/nilearn/decoding/searchlight.py b/nilearn/decoding/searchlight.py index 5829b1ff5b..c853f9e0de 100644 --- a/nilearn/decoding/searchlight.py +++ b/nilearn/decoding/searchlight.py @@ -16,7 +16,7 @@ import numpy as np -from sklearn.externals.joblib import Parallel, delayed, cpu_count +from nilearn._utils.compat import Parallel, delayed, cpu_count from sklearn import svm from sklearn.base import BaseEstimator from sklearn.exceptions import ConvergenceWarning diff --git a/nilearn/decoding/space_net.py b/nilearn/decoding/space_net.py index 9867b3ca21..368513a8ef 100644 --- a/nilearn/decoding/space_net.py +++ b/nilearn/decoding/space_net.py @@ -24,7 +24,7 @@ from sklearn.linear_model.base import LinearModel from sklearn.feature_selection import (SelectPercentile, f_regression, f_classif) -from sklearn.externals.joblib import Memory, Parallel, delayed +from nilearn._utils.compat import Memory, Parallel, delayed from sklearn.preprocessing import LabelBinarizer from sklearn.metrics import accuracy_score from ..input_data.masker_validation import check_embedded_nifti_masker diff --git a/nilearn/decoding/tests/test_searchlight.py b/nilearn/decoding/tests/test_searchlight.py index c731ad92e0..fc7b42f9df 100644 --- a/nilearn/decoding/tests/test_searchlight.py +++ b/nilearn/decoding/tests/test_searchlight.py @@ -100,10 +100,10 @@ def test_searchlight(): rand = np.random.RandomState(0) data = rand.rand(5, 5, 5) data_img = nibabel.Nifti1Image(data, affine=np.eye(4)) - imgs = [data_img, data_img, data_img, data_img, data_img, data_img] + imgs = [data_img] * 12 # labels - y = [0, 1, 0, 1, 0, 1] + y = [0, 1] * 6 # run searchlight on list of 3D images sl = searchlight.SearchLight(mask_img) diff --git a/nilearn/decomposition/base.py b/nilearn/decomposition/base.py index bb6fad4044..d479dd2078 100644 --- a/nilearn/decomposition/base.py +++ b/nilearn/decomposition/base.py @@ -14,7 +14,7 @@ import sklearn import nilearn from sklearn.base import BaseEstimator, TransformerMixin -from sklearn.externals.joblib import Memory, Parallel, delayed +from nilearn._utils.compat import Memory, Parallel, delayed from sklearn.linear_model import LinearRegression from sklearn.utils import check_random_state from sklearn.utils.extmath import randomized_svd, svd_flip diff --git a/nilearn/decomposition/canica.py b/nilearn/decomposition/canica.py index ef6d77d63a..2a4ad45aac 100644 --- a/nilearn/decomposition/canica.py +++ b/nilearn/decomposition/canica.py @@ -10,7 +10,7 @@ import numpy as np from scipy.stats import scoreatpercentile from sklearn.decomposition import fastica -from sklearn.externals.joblib import Memory, delayed, Parallel +from nilearn._utils.compat import Memory, delayed, Parallel from sklearn.utils import check_random_state from .multi_pca import MultiPCA diff --git a/nilearn/decomposition/dict_learning.py b/nilearn/decomposition/dict_learning.py index e31b2e734f..25c79a435f 100644 --- a/nilearn/decomposition/dict_learning.py +++ b/nilearn/decomposition/dict_learning.py @@ -15,7 +15,7 @@ import numpy as np import sklearn from sklearn.decomposition import dict_learning_online -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from sklearn.linear_model import Ridge from .base import BaseDecomposition diff --git a/nilearn/decomposition/multi_pca.py b/nilearn/decomposition/multi_pca.py index 5b888c615d..84b6daeb45 100644 --- a/nilearn/decomposition/multi_pca.py +++ b/nilearn/decomposition/multi_pca.py @@ -3,7 +3,7 @@ This is a good initialization method for ICA. """ import numpy as np -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from sklearn.utils.extmath import randomized_svd from .base import BaseDecomposition diff --git a/nilearn/externals/README.md b/nilearn/externals/README.md new file mode 100644 index 0000000000..0e6519bbed --- /dev/null +++ b/nilearn/externals/README.md @@ -0,0 +1,5 @@ +This directory contains bundled external dependencies. + +Note for distribution packagers: if you want to remove the duplicated +code and depend on a packaged version, we suggest that you simply do a +symbolic link in this directory. diff --git a/nilearn/externals/__init__.py b/nilearn/externals/__init__.py new file mode 100644 index 0000000000..c861213890 --- /dev/null +++ b/nilearn/externals/__init__.py @@ -0,0 +1,7 @@ +""" +External, bundled dependencies for Nilearn. + +To ignore linting on these files, at the top define: + +# flake8: noqa +""" diff --git a/nilearn/externals/conftest.py b/nilearn/externals/conftest.py new file mode 100644 index 0000000000..f3bb9d9e9a --- /dev/null +++ b/nilearn/externals/conftest.py @@ -0,0 +1,8 @@ +# Do not collect any tests in externals. This is more robust than using +# --ignore because --ignore needs a path and it is not convenient to pass in +# the externals path (very long install-dependent path in site-packages) when +# using --pyargs + + +def pytest_ignore_collect(path, config): + return True diff --git a/nilearn/externals/install_tempita.sh b/nilearn/externals/install_tempita.sh new file mode 100644 index 0000000000..9e6c1d4425 --- /dev/null +++ b/nilearn/externals/install_tempita.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Script to do a local install of tempita +set +x +export LC_ALL=C +INSTALL_FOLDER=tmp/tempita_install +rm -rf tempita $INSTALL_FOLDER +if [ -z "$1" ] +then + TEMPITA=tempita +else + TEMPITA=$1 +fi + +pip install --no-cache $TEMPITA --target $INSTALL_FOLDER +cp -r $INSTALL_FOLDER/tempita tempita +rm -rf $INSTALL_FOLDER + +# Needed to rewrite the doctests +# Note: BSD sed -i needs an argument unders OSX +# so first renaming to .bak and then deleting backup files +find tempita -name "*.py" | xargs sed -i.bak "s/from tempita/from nilearn.externals.tempita/" +find tempita -name "*.bak" | xargs rm diff --git a/nilearn/externals/tempita/__init__.py b/nilearn/externals/tempita/__init__.py new file mode 100644 index 0000000000..91f4091672 --- /dev/null +++ b/nilearn/externals/tempita/__init__.py @@ -0,0 +1,1311 @@ +# flake8: noqa +""" +A small templating language + +This implements a small templating language. This language implements +if/elif/else, for/continue/break, expressions, and blocks of Python +code. The syntax is:: + + {{any expression (function calls etc)}} + {{any expression | filter}} + {{for x in y}}...{{endfor}} + {{if x}}x{{elif y}}y{{else}}z{{endif}} + {{py:x=1}} + {{py: + def foo(bar): + return 'baz' + }} + {{default var = default_value}} + {{# comment}} + +You use this with the ``Template`` class or the ``sub`` shortcut. +The ``Template`` class takes the template string and the name of +the template (for errors) and a default namespace. Then (like +``string.Template``) you can call the ``tmpl.substitute(**kw)`` +method to make a substitution (or ``tmpl.substitute(a_dict)``). + +``sub(content, **kw)`` substitutes the template immediately. You +can use ``__name='tmpl.html'`` to set the name of the template. + +If there are syntax errors ``TemplateError`` will be raised. +""" +from __future__ import absolute_import, division, print_function + +import re +import sys +try: + from urllib.parse import quote as url_quote + from io import StringIO + from html import escape as html_escape +except ImportError: + from urllib import quote as url_quote + from cStringIO import StringIO + from cgi import escape as html_escape +import os +import tokenize +from ._looper import looper +from .compat3 import ( + PY3, bytes, basestring_, next, is_unicode, coerce_text, iteritems) + +__all__ = ['TemplateError', 'Template', 'sub', 'HTMLTemplate', + 'sub_html', 'html', 'bunch'] + +in_re = re.compile(r'\s+in\s+') +var_re = re.compile(r'^[a-z_][a-z0-9_]*$', re.I) + + +class TemplateError(Exception): + """Exception raised while parsing a template + """ + + def __init__(self, message, position, name=None): + Exception.__init__(self, message) + self.position = position + self.name = name + + def __str__(self): + msg = ' '.join(self.args) + if self.position: + msg = '%s at line %s column %s' % ( + msg, self.position[0], self.position[1]) + if self.name: + msg += ' in %s' % self.name + return msg + + +class _TemplateContinue(Exception): + pass + + +class _TemplateBreak(Exception): + pass + + +def get_file_template(name, from_template): + path = os.path.join(os.path.dirname(from_template.name), name) + return from_template.__class__.from_filename( + path, namespace=from_template.namespace, + get_template=from_template.get_template) + + +class Template(object): + + default_namespace = { + 'start_braces': '{{', + 'end_braces': '}}', + 'looper': looper, + } + + default_encoding = 'utf8' + default_inherit = None + + def __init__(self, content, name=None, namespace=None, stacklevel=None, + get_template=None, default_inherit=None, line_offset=0, + delimeters=None): + self.content = content + + # set delimeters + if delimeters is None: + delimeters = (self.default_namespace['start_braces'], + self.default_namespace['end_braces']) + else: + assert len(delimeters) == 2 and all( + [isinstance(delimeter, basestring_) + for delimeter in delimeters]) + self.default_namespace = self.__class__.default_namespace.copy() + self.default_namespace['start_braces'] = delimeters[0] + self.default_namespace['end_braces'] = delimeters[1] + self.delimeters = delimeters + + self._unicode = is_unicode(content) + if name is None and stacklevel is not None: + try: + caller = sys._getframe(stacklevel) + except ValueError: + pass + else: + globals = caller.f_globals + lineno = caller.f_lineno + if '__file__' in globals: + name = globals['__file__'] + if name.endswith('.pyc') or name.endswith('.pyo'): + name = name[:-1] + elif '__name__' in globals: + name = globals['__name__'] + else: + name = '' + if lineno: + name += ':%s' % lineno + self.name = name + self._parsed = parse( + content, name=name, line_offset=line_offset, + delimeters=self.delimeters) + if namespace is None: + namespace = {} + self.namespace = namespace + self.get_template = get_template + if default_inherit is not None: + self.default_inherit = default_inherit + + def from_filename(cls, filename, namespace=None, encoding=None, + default_inherit=None, get_template=get_file_template): + f = open(filename, 'rb') + c = f.read() + f.close() + if encoding: + c = c.decode(encoding) + elif PY3: + c = c.decode('latin-1') + return cls(content=c, name=filename, namespace=namespace, + default_inherit=default_inherit, get_template=get_template) + + from_filename = classmethod(from_filename) + + def __repr__(self): + return '<%s %s name=%r>' % ( + self.__class__.__name__, + hex(id(self))[2:], self.name) + + def substitute(self, *args, **kw): + if args: + if kw: + raise TypeError( + "You can only give positional *or* keyword arguments") + if len(args) > 1: + raise TypeError( + "You can only give one positional argument") + if not hasattr(args[0], 'items'): + raise TypeError( + ("If you pass in a single argument, you must pass in a ", + "dict-like object (with a .items() method); you gave %r") + % (args[0],)) + kw = args[0] + ns = kw + ns['__template_name__'] = self.name + if self.namespace: + ns.update(self.namespace) + result, defs, inherit = self._interpret(ns) + if not inherit: + inherit = self.default_inherit + if inherit: + result = self._interpret_inherit(result, defs, inherit, ns) + return result + + def _interpret(self, ns): + # __traceback_hide__ = True + parts = [] + defs = {} + self._interpret_codes(self._parsed, ns, out=parts, defs=defs) + if '__inherit__' in defs: + inherit = defs.pop('__inherit__') + else: + inherit = None + return ''.join(parts), defs, inherit + + def _interpret_inherit(self, body, defs, inherit_template, ns): + # __traceback_hide__ = True + if not self.get_template: + raise TemplateError( + 'You cannot use inheritance without passing in get_template', + position=None, name=self.name) + templ = self.get_template(inherit_template, self) + self_ = TemplateObject(self.name) + for name, value in iteritems(defs): + setattr(self_, name, value) + self_.body = body + ns = ns.copy() + ns['self'] = self_ + return templ.substitute(ns) + + def _interpret_codes(self, codes, ns, out, defs): + # __traceback_hide__ = True + for item in codes: + if isinstance(item, basestring_): + out.append(item) + else: + self._interpret_code(item, ns, out, defs) + + def _interpret_code(self, code, ns, out, defs): + # __traceback_hide__ = True + name, pos = code[0], code[1] + if name == 'py': + self._exec(code[2], ns, pos) + elif name == 'continue': + raise _TemplateContinue() + elif name == 'break': + raise _TemplateBreak() + elif name == 'for': + vars, expr, content = code[2], code[3], code[4] + expr = self._eval(expr, ns, pos) + self._interpret_for(vars, expr, content, ns, out, defs) + elif name == 'cond': + parts = code[2:] + self._interpret_if(parts, ns, out, defs) + elif name == 'expr': + parts = code[2].split('|') + base = self._eval(parts[0], ns, pos) + for part in parts[1:]: + func = self._eval(part, ns, pos) + base = func(base) + out.append(self._repr(base, pos)) + elif name == 'default': + var, expr = code[2], code[3] + if var not in ns: + result = self._eval(expr, ns, pos) + ns[var] = result + elif name == 'inherit': + expr = code[2] + value = self._eval(expr, ns, pos) + defs['__inherit__'] = value + elif name == 'def': + name = code[2] + signature = code[3] + parts = code[4] + ns[name] = defs[name] = TemplateDef( + self, name, signature, body=parts, ns=ns, pos=pos) + elif name == 'comment': + return + else: + assert 0, "Unknown code: %r" % name + + def _interpret_for(self, vars, expr, content, ns, out, defs): + # __traceback_hide__ = True + for item in expr: + if len(vars) == 1: + ns[vars[0]] = item + else: + if len(vars) != len(item): + raise ValueError( + 'Need %i items to unpack (got %i items)' + % (len(vars), len(item))) + for name, value in zip(vars, item): + ns[name] = value + try: + self._interpret_codes(content, ns, out, defs) + except _TemplateContinue: + continue + except _TemplateBreak: + break + + def _interpret_if(self, parts, ns, out, defs): + # __traceback_hide__ = True + # @@: if/else/else gets through + for part in parts: + assert not isinstance(part, basestring_) + name, pos = part[0], part[1] + if name == 'else': + result = True + else: + result = self._eval(part[2], ns, pos) + if result: + self._interpret_codes(part[3], ns, out, defs) + break + + def _eval(self, code, ns, pos): + # __traceback_hide__ = True + try: + try: + value = eval(code, self.default_namespace, ns) + except SyntaxError as e: + raise SyntaxError( + 'invalid syntax in expression: %s' % code) + return value + except: + exc_info = sys.exc_info() + e = exc_info[1] + if getattr(e, 'args', None): + arg0 = e.args[0] + else: + arg0 = coerce_text(e) + e.args = (self._add_line_info(arg0, pos),) + if PY3: + raise(e) + else: + raise (exc_info[1], e, exc_info[2]) + + def _exec(self, code, ns, pos): + # __traceback_hide__ = True + try: + exec(code, self.default_namespace, ns) + except: + exc_info = sys.exc_info() + e = exc_info[1] + if e.args: + e.args = (self._add_line_info(e.args[0], pos),) + else: + e.args = (self._add_line_info(None, pos),) + if PY3: + raise(e) + else: + raise (exc_info[1], e, exc_info[2]) + + def _repr(self, value, pos): + # __traceback_hide__ = True + try: + if value is None: + return '' + if self._unicode: + value = str(value) + if not is_unicode(value): + value = value.decode('utf-8') + else: + if not isinstance(value, basestring_): + value = coerce_text(value) + if (is_unicode(value) and self.default_encoding): + value = value.encode(self.default_encoding) + except: + exc_info = sys.exc_info() + e = exc_info[1] + e.args = (self._add_line_info(e.args[0], pos),) + if PY3: + raise(e) + else: + raise (exc_info[1], e, exc_info[2]) + else: + if self._unicode and isinstance(value, bytes): + if not self.default_encoding: + raise UnicodeDecodeError( + 'Cannot decode bytes value %r into unicode ' + '(no default_encoding provided)' % value) + try: + value = value.decode(self.default_encoding) + except UnicodeDecodeError as e: + raise UnicodeDecodeError( + e.encoding, + e.object, + e.start, + e.end, + e.reason + ' in string %r' % value) + elif not self._unicode and is_unicode(value): + if not self.default_encoding: + raise UnicodeEncodeError( + 'Cannot encode unicode value %r into bytes ' + '(no default_encoding provided)' % value) + value = value.encode(self.default_encoding) + return value + + def _add_line_info(self, msg, pos): + msg = "%s at line %s column %s" % ( + msg, pos[0], pos[1]) + if self.name: + msg += " in file %s" % self.name + return msg + + +def sub(content, delimeters=None, **kw): + name = kw.get('__name') + tmpl = Template(content, name=name, delimeters=delimeters) + return tmpl.substitute(kw) + + +def paste_script_template_renderer(content, vars, filename=None): + tmpl = Template(content, name=filename) + return tmpl.substitute(vars) + + +class bunch(dict): + + def __init__(self, **kw): + for name, value in iteritems(kw): + setattr(self, name, value) + + def __setattr__(self, name, value): + self[name] = value + + def __getattr__(self, name): + try: + return self[name] + except KeyError: + raise AttributeError(name) + + def __getitem__(self, key): + if 'default' in self: + try: + return dict.__getitem__(self, key) + except KeyError: + return dict.__getitem__(self, 'default') + else: + return dict.__getitem__(self, key) + + def __repr__(self): + items = [ + (k, v) for k, v in iteritems(self)] + items.sort() + return '<%s %s>' % ( + self.__class__.__name__, + ' '.join(['%s=%r' % (k, v) for k, v in items])) + +############################################################ +# HTML Templating +############################################################ + + +class html(object): + + def __init__(self, value): + self.value = value + + def __str__(self): + return self.value + + def __html__(self): + return self.value + + def __repr__(self): + return '<%s %r>' % ( + self.__class__.__name__, self.value) + + +def html_quote(value, force=True): + if not force and hasattr(value, '__html__'): + return value.__html__() + if value is None: + return '' + if not isinstance(value, basestring_): + value = coerce_text(value) + if sys.version >= "3" and isinstance(value, bytes): + value = html_escape(value.decode('latin1'), 1) + value = value.encode('latin1') + else: + value = html_escape(value, 1) + if sys.version < "3": + if is_unicode(value): + value = value.encode('ascii', 'xmlcharrefreplace') + return value + + +def url(v): + v = coerce_text(v) + if is_unicode(v): + v = v.encode('utf8') + return url_quote(v) + + +def attr(**kw): + kw = list(iteritems(kw)) + kw.sort() + parts = [] + for name, value in kw: + if value is None: + continue + if name.endswith('_'): + name = name[:-1] + parts.append('%s="%s"' % (html_quote(name), html_quote(value))) + return html(' '.join(parts)) + + +class HTMLTemplate(Template): + + default_namespace = Template.default_namespace.copy() + default_namespace.update(dict( + html=html, + attr=attr, + url=url, + html_quote=html_quote)) + + def _repr(self, value, pos): + if hasattr(value, '__html__'): + value = value.__html__() + quote = False + else: + quote = True + plain = Template._repr(self, value, pos) + if quote: + return html_quote(plain) + else: + return plain + + +def sub_html(content, **kw): + name = kw.get('__name') + tmpl = HTMLTemplate(content, name=name) + return tmpl.substitute(kw) + + +class TemplateDef(object): + def __init__(self, template, func_name, func_signature, + body, ns, pos, bound_self=None): + self._template = template + self._func_name = func_name + self._func_signature = func_signature + self._body = body + self._ns = ns + self._pos = pos + self._bound_self = bound_self + + def __repr__(self): + return '' % ( + self._func_name, self._func_signature, + self._template.name, self._pos) + + def __str__(self): + return self() + + def __call__(self, *args, **kw): + values = self._parse_signature(args, kw) + ns = self._ns.copy() + ns.update(values) + if self._bound_self is not None: + ns['self'] = self._bound_self + out = [] + subdefs = {} + self._template._interpret_codes(self._body, ns, out, subdefs) + return ''.join(out) + + def __get__(self, obj, type=None): + if obj is None: + return self + return self.__class__( + self._template, self._func_name, self._func_signature, + self._body, self._ns, self._pos, bound_self=obj) + + def _parse_signature(self, args, kw): + values = {} + sig_args, var_args, var_kw, defaults = self._func_signature + extra_kw = {} + for name, value in iteritems(kw): + if not var_kw and name not in sig_args: + raise TypeError( + 'Unexpected argument %s' % name) + if name in sig_args: + values[sig_args] = value + else: + extra_kw[name] = value + args = list(args) + sig_args = list(sig_args) + while args: + while sig_args and sig_args[0] in values: + sig_args.pop(0) + if sig_args: + name = sig_args.pop(0) + values[name] = args.pop(0) + elif var_args: + values[var_args] = tuple(args) + break + else: + raise TypeError( + 'Extra position arguments: %s' + % ', '.join(repr(v) for v in args)) + for name, value_expr in iteritems(defaults): + if name not in values: + values[name] = self._template._eval( + value_expr, self._ns, self._pos) + for name in sig_args: + if name not in values: + raise TypeError( + 'Missing argument: %s' % name) + if var_kw: + values[var_kw] = extra_kw + return values + + +class TemplateObject(object): + + def __init__(self, name): + self.__name = name + self.get = TemplateObjectGetter(self) + + def __repr__(self): + return '<%s %s>' % (self.__class__.__name__, self.__name) + + +class TemplateObjectGetter(object): + + def __init__(self, template_obj): + self.__template_obj = template_obj + + def __getattr__(self, attr): + return getattr(self.__template_obj, attr, Empty) + + def __repr__(self): + return '<%s around %r>' % ( + self.__class__.__name__, self.__template_obj) + + +class _Empty(object): + def __call__(self, *args, **kw): + return self + + def __str__(self): + return '' + + def __repr__(self): + return 'Empty' + + def __unicode__(self): + return '' if PY3 else u'' + + def __iter__(self): + return iter(()) + + def __bool__(self): + return False + + if sys.version < "3": + __nonzero__ = __bool__ + +Empty = _Empty() +del _Empty + +############################################################ +# Lexing and Parsing +############################################################ + + +def lex(s, name=None, trim_whitespace=True, line_offset=0, delimeters=None): + if delimeters is None: + delimeters = (Template.default_namespace['start_braces'], + Template.default_namespace['end_braces']) + in_expr = False + chunks = [] + last = 0 + last_pos = (line_offset + 1, 1) + token_re = re.compile(r'%s|%s' % (re.escape(delimeters[0]), + re.escape(delimeters[1]))) + for match in token_re.finditer(s): + expr = match.group(0) + pos = find_position(s, match.end(), last, last_pos) + if expr == delimeters[0] and in_expr: + raise TemplateError('%s inside expression' % delimeters[0], + position=pos, + name=name) + elif expr == delimeters[1] and not in_expr: + raise TemplateError('%s outside expression' % delimeters[1], + position=pos, + name=name) + if expr == delimeters[0]: + part = s[last:match.start()] + if part: + chunks.append(part) + in_expr = True + else: + chunks.append((s[last:match.start()], last_pos)) + in_expr = False + last = match.end() + last_pos = pos + if in_expr: + raise TemplateError('No %s to finish last expression' % delimeters[1], + name=name, position=last_pos) + part = s[last:] + if part: + chunks.append(part) + if trim_whitespace: + chunks = trim_lex(chunks) + return chunks + +lex.__doc__ = """ +Lex a string into chunks: + + >>> lex('hey') + ['hey'] + >>> lex('hey {{you}}') + ['hey ', ('you', (1, 7))] + >>> lex('hey {{') + Traceback (most recent call last): + ... + tempita.TemplateError: No }} to finish last expression at line 1 column 7 + >>> lex('hey }}') + Traceback (most recent call last): + ... + tempita.TemplateError: }} outside expression at line 1 column 7 + >>> lex('hey {{ {{') + Traceback (most recent call last): + ... + tempita.TemplateError: {{ inside expression at line 1 column 10 + +""" if PY3 else """ +Lex a string into chunks: + + >>> lex('hey') + ['hey'] + >>> lex('hey {{you}}') + ['hey ', ('you', (1, 7))] + >>> lex('hey {{') + Traceback (most recent call last): + ... + TemplateError: No }} to finish last expression at line 1 column 7 + >>> lex('hey }}') + Traceback (most recent call last): + ... + TemplateError: }} outside expression at line 1 column 7 + >>> lex('hey {{ {{') + Traceback (most recent call last): + ... + TemplateError: {{ inside expression at line 1 column 10 + +""" + +statement_re = re.compile(r'^(?:if |elif |for |def |inherit |default |py:)') +single_statements = ['else', 'endif', 'endfor', 'enddef', 'continue', 'break'] +trail_whitespace_re = re.compile(r'\n\r?[\t ]*$') +lead_whitespace_re = re.compile(r'^[\t ]*\n') + + +def trim_lex(tokens): + last_trim = None + for i in range(len(tokens)): + current = tokens[i] + if isinstance(tokens[i], basestring_): + # we don't trim this + continue + item = current[0] + if not statement_re.search(item) and item not in single_statements: + continue + if not i: + prev = '' + else: + prev = tokens[i - 1] + if i + 1 >= len(tokens): + next_chunk = '' + else: + next_chunk = tokens[i + 1] + if (not + isinstance(next_chunk, basestring_) or + not isinstance(prev, basestring_)): + continue + prev_ok = not prev or trail_whitespace_re.search(prev) + if i == 1 and not prev.strip(): + prev_ok = True + if last_trim is not None and last_trim + 2 == i and not prev.strip(): + prev_ok = 'last' + if (prev_ok and (not next_chunk or lead_whitespace_re.search( + next_chunk) or ( + i == len(tokens) - 2 and not next_chunk.strip()))): + if prev: + if ((i == 1 and not prev.strip()) or prev_ok == 'last'): + tokens[i - 1] = '' + else: + m = trail_whitespace_re.search(prev) + # +1 to leave the leading \n on: + prev = prev[:m.start() + 1] + tokens[i - 1] = prev + if next_chunk: + last_trim = i + if i == len(tokens) - 2 and not next_chunk.strip(): + tokens[i + 1] = '' + else: + m = lead_whitespace_re.search(next_chunk) + next_chunk = next_chunk[m.end():] + tokens[i + 1] = next_chunk + return tokens + +trim_lex.__doc__ = r""" + Takes a lexed set of tokens, and removes whitespace when there is + a directive on a line by itself: + + >>> tokens = lex('{{if x}}\nx\n{{endif}}\ny', trim_whitespace=False) + >>> tokens + [('if x', (1, 3)), '\nx\n', ('endif', (3, 3)), '\ny'] + >>> trim_lex(tokens) + [('if x', (1, 3)), 'x\n', ('endif', (3, 3)), 'y'] + """ if PY3 else r""" + Takes a lexed set of tokens, and removes whitespace when there is + a directive on a line by itself: + + >>> tokens = lex('{{if x}}\nx\n{{endif}}\ny', trim_whitespace=False) + >>> tokens + [('if x', (1, 3)), '\nx\n', ('endif', (3, 3)), '\ny'] + >>> trim_lex(tokens) + [('if x', (1, 3)), 'x\n', ('endif', (3, 3)), 'y'] + """ + + +def find_position(string, index, last_index, last_pos): + """ + Given a string and index, return (line, column) + """ + lines = string.count('\n', last_index, index) + if lines > 0: + column = index - string.rfind('\n', last_index, index) + else: + column = last_pos[1] + (index - last_index) + return (last_pos[0] + lines, column) + + +def parse(s, name=None, line_offset=0, delimeters=None): + + if delimeters is None: + delimeters = (Template.default_namespace['start_braces'], + Template.default_namespace['end_braces']) + tokens = lex(s, name=name, line_offset=line_offset, delimeters=delimeters) + result = [] + while tokens: + next_chunk, tokens = parse_expr(tokens, name) + result.append(next_chunk) + return result + +parse.__doc__ = r""" + Parses a string into a kind of AST + + >>> parse('{{x}}') + [('expr', (1, 3), 'x')] + >>> parse('foo') + ['foo'] + >>> parse('{{if x}}test{{endif}}') + [('cond', (1, 3), ('if', (1, 3), 'x', ['test']))] + >>> parse( + ... 'series->{{for x in y}}x={{x}}{{endfor}}' + ... ) #doctest: +NORMALIZE_WHITESPACE + ['series->', + ('for', (1, 11), ('x',), 'y', ['x=', ('expr', (1, 27), 'x')])] + >>> parse('{{for x, y in z:}}{{continue}}{{endfor}}') + [('for', (1, 3), ('x', 'y'), 'z', [('continue', (1, 21))])] + >>> parse('{{py:x=1}}') + [('py', (1, 3), 'x=1')] + >>> parse( + ... '{{if x}}a{{elif y}}b{{else}}c{{endif}}' + ... ) #doctest: +NORMALIZE_WHITESPACE + [('cond', (1, 3), ('if', (1, 3), 'x', ['a']), + ('elif', (1, 12), 'y', ['b']), ('else', (1, 23), None, ['c']))] + + Some exceptions:: + + >>> parse('{{continue}}') + Traceback (most recent call last): + ... + tempita.TemplateError: continue outside of for loop at line 1 column 3 + >>> parse('{{if x}}foo') + Traceback (most recent call last): + ... + tempita.TemplateError: No {{endif}} at line 1 column 3 + >>> parse('{{else}}') + Traceback (most recent call last): + ... + tempita.TemplateError: else outside of an if block at line 1 column 3 + >>> parse('{{if x}}{{for x in y}}{{endif}}{{endfor}}') + Traceback (most recent call last): + ... + tempita.TemplateError: Unexpected endif at line 1 column 25 + >>> parse('{{if}}{{endif}}') + Traceback (most recent call last): + ... + tempita.TemplateError: if with no expression at line 1 column 3 + >>> parse('{{for x y}}{{endfor}}') + Traceback (most recent call last): + ... + tempita.TemplateError: Bad for (no "in") in 'x y' at line 1 column 3 + >>> parse('{{py:x=1\ny=2}}') #doctest: +NORMALIZE_WHITESPACE + Traceback (most recent call last): + ... + tempita.TemplateError: Multi-line py blocks must start + with a newline at line 1 column 3 + """ if PY3 else r""" + Parses a string into a kind of AST + + >>> parse('{{x}}') + [('expr', (1, 3), 'x')] + >>> parse('foo') + ['foo'] + >>> parse('{{if x}}test{{endif}}') + [('cond', (1, 3), ('if', (1, 3), 'x', ['test']))] + >>> parse( + ... 'series->{{for x in y}}x={{x}}{{endfor}}' + ... ) #doctest: +NORMALIZE_WHITESPACE + ['series->', + ('for', (1, 11), ('x',), 'y', ['x=', ('expr', (1, 27), 'x')])] + >>> parse('{{for x, y in z:}}{{continue}}{{endfor}}') + [('for', (1, 3), ('x', 'y'), 'z', [('continue', (1, 21))])] + >>> parse('{{py:x=1}}') + [('py', (1, 3), 'x=1')] + >>> parse( + ... '{{if x}}a{{elif y}}b{{else}}c{{endif}}' + ... ) #doctest: +NORMALIZE_WHITESPACE + [('cond', (1, 3), ('if', (1, 3), 'x', ['a']), + ('elif', (1, 12), 'y', ['b']), ('else', (1, 23), None, ['c']))] + + Some exceptions:: + + >>> parse('{{continue}}') + Traceback (most recent call last): + ... + TemplateError: continue outside of for loop at line 1 column 3 + >>> parse('{{if x}}foo') + Traceback (most recent call last): + ... + TemplateError: No {{endif}} at line 1 column 3 + >>> parse('{{else}}') + Traceback (most recent call last): + ... + TemplateError: else outside of an if block at line 1 column 3 + >>> parse('{{if x}}{{for x in y}}{{endif}}{{endfor}}') + Traceback (most recent call last): + ... + TemplateError: Unexpected endif at line 1 column 25 + >>> parse('{{if}}{{endif}}') + Traceback (most recent call last): + ... + TemplateError: if with no expression at line 1 column 3 + >>> parse('{{for x y}}{{endfor}}') + Traceback (most recent call last): + ... + TemplateError: Bad for (no "in") in 'x y' at line 1 column 3 + >>> parse('{{py:x=1\ny=2}}') #doctest: +NORMALIZE_WHITESPACE + Traceback (most recent call last): + ... + TemplateError: Multi-line py blocks must start + with a newline at line 1 column 3 + """ + + +def parse_expr(tokens, name, context=()): + if isinstance(tokens[0], basestring_): + return tokens[0], tokens[1:] + expr, pos = tokens[0] + expr = expr.strip() + if expr.startswith('py:'): + expr = expr[3:].lstrip(' \t') + if expr.startswith('\n') or expr.startswith('\r'): + expr = expr.lstrip('\r\n') + if '\r' in expr: + expr = expr.replace('\r\n', '\n') + expr = expr.replace('\r', '') + expr += '\n' + else: + if '\n' in expr: + raise TemplateError( + 'Multi-line py blocks must start with a newline', + position=pos, name=name) + return ('py', pos, expr), tokens[1:] + elif expr in ('continue', 'break'): + if 'for' not in context: + raise TemplateError( + 'continue outside of for loop', + position=pos, name=name) + return (expr, pos), tokens[1:] + elif expr.startswith('if '): + return parse_cond(tokens, name, context) + elif (expr.startswith('elif ') or expr == 'else'): + raise TemplateError( + '%s outside of an if block' % expr.split()[0], + position=pos, name=name) + elif expr in ('if', 'elif', 'for'): + raise TemplateError( + '%s with no expression' % expr, + position=pos, name=name) + elif expr in ('endif', 'endfor', 'enddef'): + raise TemplateError( + 'Unexpected %s' % expr, + position=pos, name=name) + elif expr.startswith('for '): + return parse_for(tokens, name, context) + elif expr.startswith('default '): + return parse_default(tokens, name, context) + elif expr.startswith('inherit '): + return parse_inherit(tokens, name, context) + elif expr.startswith('def '): + return parse_def(tokens, name, context) + elif expr.startswith('#'): + return ('comment', pos, tokens[0][0]), tokens[1:] + return ('expr', pos, tokens[0][0]), tokens[1:] + + +def parse_cond(tokens, name, context): + start = tokens[0][1] + pieces = [] + context = context + ('if',) + while 1: + if not tokens: + raise TemplateError( + 'Missing {{endif}}', + position=start, name=name) + if (isinstance(tokens[0], tuple) and tokens[0][0] == 'endif'): + return ('cond', start) + tuple(pieces), tokens[1:] + next_chunk, tokens = parse_one_cond(tokens, name, context) + pieces.append(next_chunk) + + +def parse_one_cond(tokens, name, context): + (first, pos), tokens = tokens[0], tokens[1:] + content = [] + if first.endswith(':'): + first = first[:-1] + if first.startswith('if '): + part = ('if', pos, first[3:].lstrip(), content) + elif first.startswith('elif '): + part = ('elif', pos, first[5:].lstrip(), content) + elif first == 'else': + part = ('else', pos, None, content) + else: + assert 0, "Unexpected token %r at %s" % (first, pos) + while 1: + if not tokens: + raise TemplateError( + 'No {{endif}}', + position=pos, name=name) + if (isinstance(tokens[0], tuple) and ( + tokens[0][0] == 'endif' or tokens[0][0].startswith( + 'elif ') or tokens[0][0] == 'else')): + return part, tokens + next_chunk, tokens = parse_expr(tokens, name, context) + content.append(next_chunk) + + +def parse_for(tokens, name, context): + first, pos = tokens[0] + tokens = tokens[1:] + context = ('for',) + context + content = [] + assert first.startswith('for ') + if first.endswith(':'): + first = first[:-1] + first = first[3:].strip() + match = in_re.search(first) + if not match: + raise TemplateError( + 'Bad for (no "in") in %r' % first, + position=pos, name=name) + vars = first[:match.start()] + if '(' in vars: + raise TemplateError( + 'You cannot have () in the variable section of a for loop (%r)' + % vars, position=pos, name=name) + vars = tuple([ + v.strip() for v in first[:match.start()].split(',') + if v.strip()]) + expr = first[match.end():] + while 1: + if not tokens: + raise TemplateError( + 'No {{endfor}}', + position=pos, name=name) + if (isinstance(tokens[0], tuple) and tokens[0][0] == 'endfor'): + return ('for', pos, vars, expr, content), tokens[1:] + next_chunk, tokens = parse_expr(tokens, name, context) + content.append(next_chunk) + + +def parse_default(tokens, name, context): + first, pos = tokens[0] + assert first.startswith('default ') + first = first.split(None, 1)[1] + parts = first.split('=', 1) + if len(parts) == 1: + raise TemplateError( + "Expression must be {{default var=value}}; no = found in %r" % + first, position=pos, name=name) + var = parts[0].strip() + if ',' in var: + raise TemplateError( + "{{default x, y = ...}} is not supported", + position=pos, name=name) + if not var_re.search(var): + raise TemplateError( + "Not a valid variable name for {{default}}: %r" + % var, position=pos, name=name) + expr = parts[1].strip() + return ('default', pos, var, expr), tokens[1:] + + +def parse_inherit(tokens, name, context): + first, pos = tokens[0] + assert first.startswith('inherit ') + expr = first.split(None, 1)[1] + return ('inherit', pos, expr), tokens[1:] + + +def parse_def(tokens, name, context): + first, start = tokens[0] + tokens = tokens[1:] + assert first.startswith('def ') + first = first.split(None, 1)[1] + if first.endswith(':'): + first = first[:-1] + if '(' not in first: + func_name = first + sig = ((), None, None, {}) + elif not first.endswith(')'): + raise TemplateError("Function definition doesn't end with ): %s" % + first, position=start, name=name) + else: + first = first[:-1] + func_name, sig_text = first.split('(', 1) + sig = parse_signature(sig_text, name, start) + context = context + ('def',) + content = [] + while 1: + if not tokens: + raise TemplateError( + 'Missing {{enddef}}', + position=start, name=name) + if (isinstance(tokens[0], tuple) and tokens[0][0] == 'enddef'): + return ('def', start, func_name, sig, content), tokens[1:] + next_chunk, tokens = parse_expr(tokens, name, context) + content.append(next_chunk) + + +def parse_signature(sig_text, name, pos): + tokens = tokenize.generate_tokens(StringIO(sig_text).readline) + sig_args = [] + var_arg = None + var_kw = None + defaults = {} + + def get_token(pos=False): + try: + tok_type, tok_string, (srow, scol), (erow, ecol), line = next( + tokens) + except StopIteration: + return tokenize.ENDMARKER, '' + if pos: + return tok_type, tok_string, (srow, scol), (erow, ecol) + else: + return tok_type, tok_string + while 1: + var_arg_type = None + tok_type, tok_string = get_token() + if tok_type == tokenize.ENDMARKER: + break + if tok_type == tokenize.OP and ( + tok_string == '*' or tok_string == '**'): + var_arg_type = tok_string + tok_type, tok_string = get_token() + if tok_type != tokenize.NAME: + raise TemplateError('Invalid signature: (%s)' % sig_text, + position=pos, name=name) + var_name = tok_string + tok_type, tok_string = get_token() + if tok_type == tokenize.ENDMARKER or ( + tok_type == tokenize.OP and tok_string == ','): + if var_arg_type == '*': + var_arg = var_name + elif var_arg_type == '**': + var_kw = var_name + else: + sig_args.append(var_name) + if tok_type == tokenize.ENDMARKER: + break + continue + if var_arg_type is not None: + raise TemplateError('Invalid signature: (%s)' % sig_text, + position=pos, name=name) + if tok_type == tokenize.OP and tok_string == '=': + nest_type = None + unnest_type = None + nest_count = 0 + start_pos = end_pos = None + parts = [] + while 1: + tok_type, tok_string, s, e = get_token(True) + if start_pos is None: + start_pos = s + end_pos = e + if tok_type == tokenize.ENDMARKER and nest_count: + raise TemplateError('Invalid signature: (%s)' % sig_text, + position=pos, name=name) + if (not nest_count and + (tok_type == tokenize.ENDMARKER or + (tok_type == tokenize.OP and tok_string == ','))): + default_expr = isolate_expression( + sig_text, start_pos, end_pos) + defaults[var_name] = default_expr + sig_args.append(var_name) + break + parts.append((tok_type, tok_string)) + if nest_count \ + and tok_type == tokenize.OP \ + and tok_string == nest_type: + nest_count += 1 + elif nest_count \ + and tok_type == tokenize.OP \ + and tok_string == unnest_type: + nest_count -= 1 + if not nest_count: + nest_type = unnest_type = None + elif not nest_count \ + and tok_type == tokenize.OP \ + and tok_string in ('(', '[', '{'): + nest_type = tok_string + nest_count = 1 + unnest_type = {'(': ')', '[': ']', '{': '}'}[nest_type] + return sig_args, var_arg, var_kw, defaults + + +def isolate_expression(string, start_pos, end_pos): + srow, scol = start_pos + srow -= 1 + erow, ecol = end_pos + erow -= 1 + lines = string.splitlines(True) + if srow == erow: + return lines[srow][scol:ecol] + parts = [lines[srow][scol:]] + parts.extend(lines[srow + 1:erow]) + if erow < len(lines): + # It'll sometimes give (end_row_past_finish, 0) + parts.append(lines[erow][:ecol]) + return ''.join(parts) + +_fill_command_usage = """\ +%prog [OPTIONS] TEMPLATE arg=value + +Use py:arg=value to set a Python value; otherwise all values are +strings. +""" + + +def fill_command(args=None): + import sys + import optparse + import pkg_resources + import os + if args is None: + args = sys.argv[1:] + dist = pkg_resources.get_distribution('Paste') + parser = optparse.OptionParser( + version=coerce_text(dist), + usage=_fill_command_usage) + parser.add_option( + '-o', '--output', + dest='output', + metavar="FILENAME", + help="File to write output to (default stdout)") + parser.add_option( + '--html', + dest='use_html', + action='store_true', + help="Use HTML style filling (including automatic HTML quoting)") + parser.add_option( + '--env', + dest='use_env', + action='store_true', + help="Put the environment in as top-level variables") + options, args = parser.parse_args(args) + if len(args) < 1: + print('You must give a template filename') + sys.exit(2) + template_name = args[0] + args = args[1:] + vars = {} + if options.use_env: + vars.update(os.environ) + for value in args: + if '=' not in value: + print('Bad argument: %r' % value) + sys.exit(2) + name, value = value.split('=', 1) + if name.startswith('py:'): + name = name[:3] + value = eval(value) + vars[name] = value + if template_name == '-': + template_content = sys.stdin.read() + template_name = '' + else: + f = open(template_name, 'rb', encoding="latin-1") + template_content = f.read() + f.close() + if options.use_html: + TemplateClass = HTMLTemplate + else: + TemplateClass = Template + template = TemplateClass(template_content, name=template_name) + result = template.substitute(vars) + if options.output: + f = open(options.output, 'wb') + f.write(result) + f.close() + else: + sys.stdout.write(result) + +if __name__ == '__main__': + fill_command() diff --git a/nilearn/externals/tempita/_looper.py b/nilearn/externals/tempita/_looper.py new file mode 100644 index 0000000000..a2a67800d8 --- /dev/null +++ b/nilearn/externals/tempita/_looper.py @@ -0,0 +1,163 @@ +""" +Helper for looping over sequences, particular in templates. + +Often in a loop in a template it's handy to know what's next up, +previously up, if this is the first or last item in the sequence, etc. +These can be awkward to manage in a normal Python loop, but using the +looper you can get a better sense of the context. Use like:: + + >>> for loop, item in looper(['a', 'b', 'c']): + ... print(loop.number, item) + ... if not loop.last: + ... print('---') + 1 a + --- + 2 b + --- + 3 c + +""" +from __future__ import absolute_import, division, print_function + +import sys +from .compat3 import basestring_ + +__all__ = ['looper'] + + +class looper(object): + """ + Helper for looping (particularly in templates) + + Use this like:: + + for loop, item in looper(seq): + if loop.first: + ... + """ + + def __init__(self, seq): + self.seq = seq + + def __iter__(self): + return looper_iter(self.seq) + + def __repr__(self): + return '<%s for %r>' % ( + self.__class__.__name__, self.seq) + + +class looper_iter(object): + + def __init__(self, seq): + self.seq = list(seq) + self.pos = 0 + + def __iter__(self): + return self + + def __next__(self): + if self.pos >= len(self.seq): + raise StopIteration + result = loop_pos(self.seq, self.pos), self.seq[self.pos] + self.pos += 1 + return result + + if sys.version < "3": + next = __next__ + + +class loop_pos(object): + + def __init__(self, seq, pos): + self.seq = seq + self.pos = pos + + def __repr__(self): + return '' % ( + self.seq[self.pos], self.pos) + + def index(self): + return self.pos + index = property(index) + + def number(self): + return self.pos + 1 + number = property(number) + + def item(self): + return self.seq[self.pos] + item = property(item) + + def __next__(self): + try: + return self.seq[self.pos + 1] + except IndexError: + return None + __next__ = property(__next__) + + if sys.version < "3": + next = __next__ + + def previous(self): + if self.pos == 0: + return None + return self.seq[self.pos - 1] + previous = property(previous) + + def odd(self): + return not self.pos % 2 + odd = property(odd) + + def even(self): + return self.pos % 2 + even = property(even) + + def first(self): + return self.pos == 0 + first = property(first) + + def last(self): + return self.pos == len(self.seq) - 1 + last = property(last) + + def length(self): + return len(self.seq) + length = property(length) + + def first_group(self, getter=None): + """ + Returns true if this item is the start of a new group, + where groups mean that some attribute has changed. The getter + can be None (the item itself changes), an attribute name like + ``'.attr'``, a function, or a dict key or list index. + """ + if self.first: + return True + return self._compare_group(self.item, self.previous, getter) + + def last_group(self, getter=None): + """ + Returns true if this item is the end of a new group, + where groups mean that some attribute has changed. The getter + can be None (the item itself changes), an attribute name like + ``'.attr'``, a function, or a dict key or list index. + """ + if self.last: + return True + return self._compare_group(self.item, self.__next__, getter) + + def _compare_group(self, item, other, getter): + if getter is None: + return item != other + elif (isinstance(getter, basestring_) and getter.startswith('.')): + getter = getter[1:] + if getter.endswith('()'): + getter = getter[:-2] + return getattr(item, getter)() != getattr(other, getter)() + else: + return getattr(item, getter) != getattr(other, getter) + elif hasattr(getter, '__call__'): + return getter(item) != getter(other) + else: + return item[getter] != other[getter] diff --git a/nilearn/externals/tempita/compat3.py b/nilearn/externals/tempita/compat3.py new file mode 100644 index 0000000000..861f5aaf1a --- /dev/null +++ b/nilearn/externals/tempita/compat3.py @@ -0,0 +1,56 @@ +# flake8: noqa +from __future__ import absolute_import, division, print_function + +import sys + +__all__ = ['PY3', 'b', 'basestring_', 'bytes', 'next', 'is_unicode', + 'iteritems'] + +PY3 = True if sys.version_info[0] == 3 else False + +if sys.version_info[0] < 3: + + def next(obj): + return obj.next() + + def iteritems(d, **kw): + return d.iteritems(**kw) + + b = bytes = str + basestring_ = basestring + +else: + + def b(s): + if isinstance(s, str): + return s.encode('latin1') + return bytes(s) + + def iteritems(d, **kw): + return iter(d.items(**kw)) + + next = next + basestring_ = (bytes, str) + bytes = bytes + +text = str + + +def is_unicode(obj): + if sys.version_info[0] < 3: + return isinstance(obj, unicode) + else: + return isinstance(obj, str) + + +def coerce_text(v): + if not isinstance(v, basestring_): + if sys.version_info[0] < 3: + attr = '__unicode__' + else: + attr = '__str__' + if hasattr(v, attr): + return unicode(v) + else: + return bytes(v) + return v diff --git a/nilearn/image/image.py b/nilearn/image/image.py index 0387ee1ea5..61623200df 100644 --- a/nilearn/image/image.py +++ b/nilearn/image/image.py @@ -14,7 +14,7 @@ from scipy.stats import scoreatpercentile import copy import nibabel -from sklearn.externals.joblib import Parallel, delayed +from nilearn._utils.compat import Parallel, delayed from .. import signal from .._utils import (check_niimg_4d, check_niimg_3d, check_niimg, as_ndarray, @@ -172,8 +172,8 @@ def _smooth_array(arr, affine, fwhm=None, ensure_finite=True, copy=True): filtering. copy: bool - if True, input array is not modified. False by default: the filtering - is performed in-place. + if True, input array is not modified. True by default: the filtering + is not performed in-place. Returns ------- @@ -705,7 +705,7 @@ def new_img_like(ref_niimg, data, affine=None, copy_header=False): return klass(data, affine, header=header) -def threshold_img(img, threshold, mask_img=None): +def threshold_img(img, threshold, mask_img=None, copy=True): """ Threshold the given input image, mostly statistical or atlas images. Thresholding can be done based on direct image intensities or selection @@ -732,6 +732,10 @@ def threshold_img(img, threshold, mask_img=None): Mask image applied to mask the input data. If None, no masking will be applied. + copy: bool + if True, input array is not modified. True by default: the filtering + is not performed in-place. + Returns ------- threshold_img: Nifti1Image @@ -742,6 +746,8 @@ def threshold_img(img, threshold, mask_img=None): img = check_niimg(img) img_data = _safe_get_data(img, ensure_finite=True) + if copy: + img_data = img_data.copy() affine = img.affine if mask_img is not None: diff --git a/nilearn/image/tests/test_image.py b/nilearn/image/tests/test_image.py index 92232c75e2..fe78003965 100644 --- a/nilearn/image/tests/test_image.py +++ b/nilearn/image/tests/test_image.py @@ -499,6 +499,27 @@ def test_threshold_img(): # when threshold is a percentile thr_maps_percent2 = threshold_img(img, threshold='2%') +def test_threshold_img_copy(): + + img_zeros = Nifti1Image(np.zeros((10, 10, 10, 10)), np.eye(4)) + img_ones = Nifti1Image(np.ones((10, 10, 10, 10)), np.eye(4)) + + # Check that copy does not mutate. It returns modified copy. + thresholded = threshold_img(img_ones, 2) # threshold 2 > 1 + + # Original img_ones should have all ones. + assert_array_equal(img_ones.get_data(), np.ones((10, 10, 10, 10))) + # Thresholded should have all zeros. + assert_array_equal(thresholded.get_data(), np.zeros((10, 10, 10, 10))) + + # Check that not copying does mutate. + img_to_mutate = Nifti1Image(np.ones((10, 10, 10, 10)), np.eye(4)) + thresholded = threshold_img(img_to_mutate, 2, copy=False) + # Check that original mutates + assert_array_equal(img_to_mutate.get_data(), np.zeros((10, 10, 10, 10))) + # And that returned value is also thresholded. + assert_array_equal(img_to_mutate.get_data(), thresholded.get_data()) + def test_isnan_threshold_img_data(): shape = (10, 10, 10) diff --git a/nilearn/input_data/base_masker.py b/nilearn/input_data/base_masker.py index f90b54785f..af604b581e 100644 --- a/nilearn/input_data/base_masker.py +++ b/nilearn/input_data/base_masker.py @@ -10,7 +10,7 @@ import numpy as np from sklearn.base import BaseEstimator, TransformerMixin -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from .. import masking from .. import image diff --git a/nilearn/input_data/multi_nifti_masker.py b/nilearn/input_data/multi_nifti_masker.py index f0f5737684..b70f44297e 100644 --- a/nilearn/input_data/multi_nifti_masker.py +++ b/nilearn/input_data/multi_nifti_masker.py @@ -8,7 +8,7 @@ import itertools import warnings -from sklearn.externals.joblib import Memory, Parallel, delayed +from nilearn._utils.compat import Memory, Parallel, delayed from .. import _utils from .. import image @@ -36,12 +36,18 @@ class MultiNiftiMasker(NiftiMasker, CacheMixin): fine tune the mask extraction. smoothing_fwhm: float, optional - If smoothing_fwhm is not None, it gives the size in millimeters of the - spatial smoothing to apply to the signal. - - standardize: boolean, optional - If standardize is True, the time-series are centered and normed: - their mean is put to 0 and their variance to 1 in the time dimension. + If smoothing_fwhm is not None, it gives the size in millimeters of + the spatial smoothing to apply to the signal. + + standardize: {'zscore', 'psc', True, False}, default is 'zscore' + Strategy to standardize the signal. + 'zscore': the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + 'psc': Timeseries are shifted to zero mean value and scaled + to percent signal change (as compared to original mean signal). + True : the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + False : Do not standardize the data. detrend: boolean, optional This parameter is passed to signal.clean. Please see the related @@ -121,13 +127,11 @@ class MultiNiftiMasker(NiftiMasker, CacheMixin): """ def __init__(self, mask_img=None, smoothing_fwhm=None, - standardize=False, detrend=False, - low_pass=None, high_pass=None, t_r=None, - target_affine=None, target_shape=None, - mask_strategy='background', mask_args=None, dtype=None, - memory=Memory(cachedir=None), memory_level=0, - n_jobs=1, verbose=0 - ): + standardize=False, detrend=False, low_pass=None, + high_pass=None, t_r=None, target_affine=None, + target_shape=None, mask_strategy='background', + mask_args=None, dtype=None, memory=Memory(cachedir=None), + memory_level=0, n_jobs=1, verbose=0): # Mask is provided or computed self.mask_img = mask_img diff --git a/nilearn/input_data/nifti_labels_masker.py b/nilearn/input_data/nifti_labels_masker.py index f4e6dca9ea..22223e6b52 100644 --- a/nilearn/input_data/nifti_labels_masker.py +++ b/nilearn/input_data/nifti_labels_masker.py @@ -4,7 +4,7 @@ import numpy as np -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from .. import _utils from .._utils import logger, CacheMixin, _compose_err_msg @@ -56,9 +56,15 @@ class NiftiLabelsMasker(BaseMasker, CacheMixin): If smoothing_fwhm is not None, it gives the full-width half maximum in millimeters of the spatial smoothing to apply to the signal. - standardize: boolean, optional - If standardize is True, the time-series are centered and normed: - their mean is put to 0 and their variance to 1 in the time dimension. + standardize: {'zscore', 'psc', True, False}, default is 'zscore' + Strategy to standardize the signal. + 'zscore': the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + 'psc': Timeseries are shifted to zero mean value and scaled + to percent signal change (as compared to original mean signal). + True : the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + False : Do not standardize the data. detrend: boolean, optional This parameter is passed to signal.clean. Please see the related diff --git a/nilearn/input_data/nifti_maps_masker.py b/nilearn/input_data/nifti_maps_masker.py index 0cb57567f9..c9ff8525ab 100644 --- a/nilearn/input_data/nifti_maps_masker.py +++ b/nilearn/input_data/nifti_maps_masker.py @@ -3,7 +3,7 @@ """ import numpy as np -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from .. import _utils from .._utils import logger, CacheMixin @@ -22,11 +22,11 @@ def __init__(self, _resampled_maps_img_, _resampled_mask_img_): self._resampled_mask_img_ = _resampled_mask_img_ def __call__(self, imgs): - from ..regions import signal_extraction + from ..regions import signal_extraction - return signal_extraction.img_to_signals_maps( - imgs, self._resampled_maps_img_, - mask_img=self._resampled_mask_img_) + return signal_extraction.img_to_signals_maps( + imgs, self._resampled_maps_img_, + mask_img=self._resampled_mask_img_) class NiftiMapsMasker(BaseMasker, CacheMixin): @@ -58,9 +58,15 @@ class NiftiMapsMasker(BaseMasker, CacheMixin): If smoothing_fwhm is not None, it gives the full-width half maximum in millimeters of the spatial smoothing to apply to the signal. - standardize: boolean, optional - If standardize is True, the time-series are centered and normed: - their mean is put to 0 and their variance to 1 in the time dimension. + standardize: {'zscore', 'psc', True, False}, default is 'zscore' + Strategy to standardize the signal. + 'zscore': the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + 'psc': Timeseries are shifted to zero mean value and scaled + to percent signal change (as compared to original mean signal). + True : the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + False : Do not standardize the data. detrend: boolean, optional This parameter is passed to signal.clean. Please see the related @@ -116,10 +122,9 @@ class NiftiMapsMasker(BaseMasker, CacheMixin): # memory and memory_level are used by CacheMixin. def __init__(self, maps_img, mask_img=None, - allow_overlap=True, - smoothing_fwhm=None, standardize=False, detrend=False, - low_pass=None, high_pass=None, t_r=None, dtype=None, - resampling_target="data", + allow_overlap=True, smoothing_fwhm=None, standardize=False, + detrend=False, low_pass=None, high_pass=None, t_r=None, + dtype=None, resampling_target="data", memory=Memory(cachedir=None, verbose=0), memory_level=0, verbose=0): self.maps_img = maps_img diff --git a/nilearn/input_data/nifti_masker.py b/nilearn/input_data/nifti_masker.py index 9a752b7c89..cd1a29fa36 100644 --- a/nilearn/input_data/nifti_masker.py +++ b/nilearn/input_data/nifti_masker.py @@ -4,14 +4,16 @@ # Author: Gael Varoquaux, Alexandre Abraham # License: simplified BSD +import warnings from copy import copy as copy_object -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from .base_masker import BaseMasker, filter_and_extract from .. import _utils from .. import image from .. import masking +from nilearn.reporting import ReportMixin from .._utils import CacheMixin from .._utils.class_inspect import get_params from .._utils.niimg import img_data_dtype @@ -63,7 +65,7 @@ def filter_and_mask(imgs, mask_img_, parameters, return data -class NiftiMasker(BaseMasker, CacheMixin): +class NiftiMasker(BaseMasker, CacheMixin, ReportMixin): """Applying a mask to extract time-series from Niimg-like objects. NiftiMasker is useful when preprocessing (detrending, standardization, @@ -86,25 +88,31 @@ class NiftiMasker(BaseMasker, CacheMixin): If smoothing_fwhm is not None, it gives the full-width half maximum in millimeters of the spatial smoothing to apply to the signal. - standardize : boolean, optional - If standardize is True, the time-series are centered and normed: - their mean is put to 0 and their variance to 1 in the time dimension. + standardize: {'zscore', 'psc', True, False}, default is 'zscore' + Strategy to standardize the signal. + 'zscore': the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + 'psc': Timeseries are shifted to zero mean value and scaled + to percent signal change (as compared to original mean signal). + True : the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + False : Do not standardize the data. detrend : boolean, optional This parameter is passed to signal.clean. Please see the related - documentation for details + documentation for details: :func:`nilearn.signal.clean`. low_pass: None or float, optional This parameter is passed to signal.clean. Please see the related - documentation for details + documentation for details: :func:`nilearn.signal.clean`. high_pass: None or float, optional This parameter is passed to signal.clean. Please see the related - documentation for details + documentation for details: :func:`nilearn.signal.clean`. t_r : float, optional This parameter is passed to signal.clean. Please see the related - documentation for details + documentation for details: :func:`nilearn.signal.clean`. target_affine : 3x3 or 4x4 matrix, optional This parameter is passed to image.resample_img. Please see the @@ -178,7 +186,7 @@ def __init__(self, mask_img=None, sessions=None, smoothing_fwhm=None, mask_strategy='background', mask_args=None, sample_mask=None, dtype=None, memory_level=1, memory=Memory(cachedir=None), - verbose=0 + verbose=0, reports=True, ): # Mask is provided or computed self.mask_img = mask_img @@ -200,9 +208,78 @@ def __init__(self, mask_img=None, sessions=None, smoothing_fwhm=None, self.memory = memory self.memory_level = memory_level self.verbose = verbose + self.reports = reports + self._report_description = ('This report shows the input Nifti ' + 'image overlaid with the outlines of the ' + 'mask (in green). We recommend to inspect ' + 'the report for the overlap between the ' + 'mask and its input image. ') + self._overlay_text = ('\n To see the input Nifti image before ' + 'resampling, hover over the displayed image.') self._shelving = False + def _reporting(self): + """ + Returns + ------- + displays : list + A list of all displays to be rendered. + """ + try: + from nilearn import plotting + except ImportError: + with warnings.catch_warnings(): + mpl_unavail_msg = ('Matplotlib is not imported! ' + 'No reports will be generated.') + warnings.filterwarnings('always', message=mpl_unavail_msg) + warnings.warn(category=ImportWarning, + message=mpl_unavail_msg) + return [None] + + img = self._reporting_data['images'] + mask = self._reporting_data['mask'] + if img is not None: + dim = image.load_img(img).shape + if len(dim) == 4: + # compute middle image from 4D series for plotting + img = image.index_img(img, dim[-1] // 2) + else: # images were not provided to fit + img = mask + + # create display of retained input mask, image + # for visual comparison + init_display = plotting.plot_img(img, + black_bg=False, + cmap='CMRmap_r') + init_display.add_contours(mask, levels=[.5], colors='g', + linewidths=2.5) + + if 'transform' not in self._reporting_data: + return [init_display] + + else: # if resampling was performed + self._report_description = (self._report_description + + self._overlay_text) + + # create display of resampled NiftiImage and mask + # assuming that resampl_img has same dim as img + resampl_img, resampl_mask = self._reporting_data['transform'] + if resampl_img is not None: + if len(dim) == 4: + # compute middle image from 4D series for plotting + resampl_img = image.index_img(resampl_img, dim[-1] // 2) + else: # images were not provided to fit + resampl_img = resampl_mask + + final_display = plotting.plot_img(resampl_img, + black_bg=False, + cmap='CMRmap_r') + final_display.add_contours(resampl_mask, levels=[.5], + colors='g', linewidths=2.5) + + return [init_display, final_display] + def _check_fitted(self): if not hasattr(self, 'mask_img_'): raise ValueError('It seems that %s has not been fitted. ' @@ -248,6 +325,11 @@ def fit(self, imgs=None, y=None): else: self.mask_img_ = _utils.check_niimg_3d(self.mask_img) + if self.reports: # save inputs for reporting + self._reporting_data = {'images': imgs, 'mask': self.mask_img_} + else: + self._reporting_data = None + # If resampling is requested, resample also the mask # Resampling: allows the user to change the affine, the shape or both if self.verbose > 0: @@ -257,14 +339,25 @@ def fit(self, imgs=None, y=None): target_affine=self.target_affine, target_shape=self.target_shape, copy=False, interpolation='nearest') - if self.target_affine is not None: + if self.target_affine is not None: # resample image to target affine self.affine_ = self.target_affine - else: + else: # resample image to mask affine self.affine_ = self.mask_img_.affine # Load data in memory self.mask_img_.get_data() if self.verbose > 10: print("[%s.fit] Finished fit" % self.__class__.__name__) + + if (self.target_shape is not None) or (self.target_affine is not None): + if self.reports: + if imgs is not None: + resampl_imgs = self._cache(image.resample_img)( + imgs, target_affine=self.affine_, + copy=False, interpolation='nearest') + else: # imgs not provided to fit + resampl_imgs = None + self._reporting_data['transform'] = [resampl_imgs, self.mask_img_] + return self def transform_single_imgs(self, imgs, confounds=None, copy=True): @@ -279,7 +372,7 @@ def transform_single_imgs(self, imgs, confounds=None, copy=True): confounds: CSV file or array-like, optional This parameter is passed to signal.clean. Please see the related - documentation for details. + documentation for details: :func:`nilearn.signal.clean`. shape: (number of scans, number of confounds) Returns diff --git a/nilearn/input_data/nifti_spheres_masker.py b/nilearn/input_data/nifti_spheres_masker.py index fc7e829d58..9eb8aef701 100644 --- a/nilearn/input_data/nifti_spheres_masker.py +++ b/nilearn/input_data/nifti_spheres_masker.py @@ -7,7 +7,7 @@ import numpy as np import warnings from sklearn import neighbors -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from ..image.resampling import coord_transform from .._utils.niimg_conversions import _safe_get_data @@ -167,9 +167,15 @@ class NiftiSpheresMasker(BaseMasker, CacheMixin): If smoothing_fwhm is not None, it gives the full-width half maximum in millimeters of the spatial smoothing to apply to the signal. - standardize: boolean, optional - If standardize is True, the time-series are centered and normed: - their mean is set to 0 and their variance to 1 in the time dimension. + standardize: {'zscore', 'psc', True, False}, default is 'zscore' + Strategy to standardize the signal. + 'zscore': the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + 'psc': Timeseries are shifted to zero mean value and scaled + to percent signal change (as compared to original mean signal). + True : the signal is z-scored. Timeseries are shifted + to zero mean and scaled to unit variance. + False : Do not standardize the data. detrend: boolean, optional This parameter is passed to signal.clean. Please see the related diff --git a/nilearn/input_data/tests/test_base_masker.py b/nilearn/input_data/tests/test_base_masker.py index 3903e9935b..967b6d03c2 100644 --- a/nilearn/input_data/tests/test_base_masker.py +++ b/nilearn/input_data/tests/test_base_masker.py @@ -37,7 +37,7 @@ def test_cropping_code_paths(): "low_pass": None, "t_r": None, "detrend": None, - "standardize": None + "standardize": 'zscore', } # Now do the two maskings diff --git a/nilearn/input_data/tests/test_masker_validation.py b/nilearn/input_data/tests/test_masker_validation.py index 7972769919..4522d7edb3 100644 --- a/nilearn/input_data/tests/test_masker_validation.py +++ b/nilearn/input_data/tests/test_masker_validation.py @@ -3,7 +3,7 @@ import numpy as np from sklearn.base import BaseEstimator -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from nilearn._utils.testing import assert_warns from nilearn.input_data.masker_validation import check_embedded_nifti_masker @@ -54,10 +54,10 @@ def test_check_embedded_nifti_masker(): if param_key not in ['memory', 'memory_level', 'n_jobs', 'verbose']: assert_equal(getattr(masker, param_key), - getattr(mask, param_key)) + getattr(mask, param_key)) else: assert_equal(getattr(masker, param_key), - getattr(owner, param_key)) + getattr(owner, param_key)) # Check use of mask as mask_img shape = (6, 8, 10, 5) diff --git a/nilearn/input_data/tests/test_multi_nifti_masker.py b/nilearn/input_data/tests/test_multi_nifti_masker.py index 620864d10c..ef46fe0814 100644 --- a/nilearn/input_data/tests/test_multi_nifti_masker.py +++ b/nilearn/input_data/tests/test_multi_nifti_masker.py @@ -14,7 +14,7 @@ from nose import SkipTest from nose.tools import assert_true, assert_false, assert_raises, assert_equal from numpy.testing import assert_array_equal -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from nilearn._utils.exceptions import DimensionError from nilearn._utils.testing import assert_raises_regex, write_tmp_imgs @@ -116,7 +116,7 @@ def test_3d_images(): def test_joblib_cache(): - from sklearn.externals.joblib import hash + from nilearn._utils.compat import hash # Dummy mask mask = np.zeros((40, 40, 40)) mask[20, 20, 20] = 1 @@ -196,3 +196,37 @@ def test_dtype(): masked_img = masker.transform([[img]]) assert(masked_img[0].dtype == np.float32) + + +def test_standardization(): + data_shape = (9, 9, 5) + n_samples = 500 + + signals = np.random.randn(2, np.prod(data_shape), n_samples) + means = np.random.randn(2, np.prod(data_shape), 1) * 50 + 1000 + signals += means + + img1 = Nifti1Image(signals[0].reshape(data_shape + (n_samples,)), + np.eye(4)) + img2 = Nifti1Image(signals[1].reshape(data_shape + (n_samples,)), + np.eye(4)) + + mask = Nifti1Image(np.ones(data_shape), np.eye(4)) + + # z-score + masker = MultiNiftiMasker(mask, standardize='zscore') + trans_signals = masker.fit_transform([img1, img2]) + + for ts in trans_signals: + np.testing.assert_almost_equal(ts.mean(0), 0) + np.testing.assert_almost_equal(ts.std(0), 1) + + # psc + masker = MultiNiftiMasker(mask, standardize='psc') + trans_signals = masker.fit_transform([img1, img2]) + + for ts, s in zip(trans_signals, signals): + np.testing.assert_almost_equal(ts.mean(0), 0) + np.testing.assert_almost_equal(ts, + (s / s.mean(1)[:, np.newaxis] * + 100 - 100).T) diff --git a/nilearn/input_data/tests/test_nifti_labels_masker.py b/nilearn/input_data/tests/test_nifti_labels_masker.py index 18e7148e3b..fe936028a6 100644 --- a/nilearn/input_data/tests/test_nifti_labels_masker.py +++ b/nilearn/input_data/tests/test_nifti_labels_masker.py @@ -266,3 +266,38 @@ def test_nifti_labels_masker_resampling(): compressed_img2 = masker.inverse_transform(transformed2) np.testing.assert_array_equal(compressed_img.get_data(), compressed_img2.get_data()) + + +def test_standardization(): + data_shape = (9, 9, 5) + n_samples = 500 + + signals = np.random.randn(np.prod(data_shape), n_samples) + means = np.random.randn(np.prod(data_shape), 1) * 50 + 1000 + signals += means + img = nibabel.Nifti1Image( + signals.reshape(data_shape + (n_samples,)), np.eye(4) + ) + + labels = data_gen.generate_labeled_regions((9, 9, 5), 10) + + # Unstandarized + masker = NiftiLabelsMasker(labels, standardize=False) + unstandarized_label_signals = masker.fit_transform(img) + + # z-score + masker = NiftiLabelsMasker(labels, standardize='zscore') + trans_signals = masker.fit_transform(img) + + np.testing.assert_almost_equal(trans_signals.mean(0), 0) + np.testing.assert_almost_equal(trans_signals.std(0), 1) + + # psc + masker = NiftiLabelsMasker(labels, standardize='psc') + trans_signals = masker.fit_transform(img) + + np.testing.assert_almost_equal(trans_signals.mean(0), 0) + np.testing.assert_almost_equal(trans_signals, + (unstandarized_label_signals / + unstandarized_label_signals.mean(0) * + 100 - 100)) diff --git a/nilearn/input_data/tests/test_nifti_maps_masker.py b/nilearn/input_data/tests/test_nifti_maps_masker.py index 82c09b9b76..e931220999 100644 --- a/nilearn/input_data/tests/test_nifti_maps_masker.py +++ b/nilearn/input_data/tests/test_nifti_maps_masker.py @@ -298,3 +298,39 @@ def test_nifti_maps_masker_overlap(): allow_overlap=False) assert_raises_regex(ValueError, 'Overlap detected', non_overlapping_masker.fit_transform, fmri_img) + + +def test_standardization(): + data_shape = (9, 9, 5) + n_samples = 500 + + signals = np.random.randn(np.prod(data_shape), n_samples) + means = np.random.randn(np.prod(data_shape), 1) * 50 + 1000 + signals += means + img = nibabel.Nifti1Image(signals.reshape(data_shape + (n_samples,)), + np.eye(4)) + + maps, _ = data_gen.generate_maps((9, 9, 5), 10) + + # Unstandarized + masker = NiftiMapsMasker(maps, standardize=False) + unstandarized_label_signals = masker.fit_transform(img) + + # z-score + masker = NiftiMapsMasker(maps, + standardize='zscore') + trans_signals = masker.fit_transform(img) + + np.testing.assert_almost_equal(trans_signals.mean(0), 0) + np.testing.assert_almost_equal(trans_signals.std(0), 1) + + # psc + masker = NiftiMapsMasker(maps, standardize='psc') + trans_signals = masker.fit_transform(img) + + np.testing.assert_almost_equal(trans_signals.mean(0), 0) + np.testing.assert_almost_equal( + trans_signals, + unstandarized_label_signals / + unstandarized_label_signals.mean(0) * 100 - 100, + ) diff --git a/nilearn/input_data/tests/test_nifti_masker.py b/nilearn/input_data/tests/test_nifti_masker.py index 4c857ff820..94eb09aa54 100644 --- a/nilearn/input_data/tests/test_nifti_masker.py +++ b/nilearn/input_data/tests/test_nifti_masker.py @@ -233,7 +233,7 @@ def test_sessions(): def test_joblib_cache(): - from sklearn.externals.joblib import hash, Memory + from nilearn._utils.compat import hash, Memory mask = np.zeros((40, 40, 40)) mask[20, 20, 20] = 1 mask_img = Nifti1Image(mask, np.eye(4)) @@ -390,3 +390,31 @@ def test_dtype(): masker_2 = NiftiMasker(dtype='float64') assert(masker_2.fit_transform(img_32).dtype == np.float64) assert(masker_2.fit_transform(img_64).dtype == np.float64) + + +def test_standardization(): + data_shape = (9, 9, 5) + n_samples = 500 + + signals = np.random.randn(np.prod(data_shape), n_samples) + means = np.random.randn(np.prod(data_shape), 1) * 50 + 1000 + signals += means + img = Nifti1Image(signals.reshape(data_shape + (n_samples,)), np.eye(4)) + + mask = Nifti1Image(np.ones(data_shape), np.eye(4)) + + # z-score + masker = NiftiMasker(mask, standardize='zscore') + trans_signals = masker.fit_transform(img) + + np.testing.assert_almost_equal(trans_signals.mean(0), 0) + np.testing.assert_almost_equal(trans_signals.std(0), 1) + + # psc + masker = NiftiMasker(mask, standardize='psc') + trans_signals = masker.fit_transform(img) + + np.testing.assert_almost_equal(trans_signals.mean(0), 0) + np.testing.assert_almost_equal(trans_signals, + (signals / signals.mean(1)[:, np.newaxis] * + 100 - 100).T) diff --git a/nilearn/input_data/tests/test_nifti_spheres_masker.py b/nilearn/input_data/tests/test_nifti_spheres_masker.py index 21d1c2cef7..0df537ec1c 100644 --- a/nilearn/input_data/tests/test_nifti_spheres_masker.py +++ b/nilearn/input_data/tests/test_nifti_spheres_masker.py @@ -5,6 +5,7 @@ from nilearn._utils.testing import assert_raises_regex from nose.tools import assert_false + def test_seed_extraction(): data = np.random.random((3, 3, 3, 5)) img = nibabel.Nifti1Image(data, np.eye(4)) @@ -62,6 +63,7 @@ def test_anisotropic_sphere_extraction(): affine_2[0, 0] = 4 mask_img = nibabel.Nifti1Image(mask_img, affine=affine_2) masker = NiftiSpheresMasker([(2, 1, 2)], radius=1, mask_img=mask_img) + masker.fit() s = masker.transform(img) assert_array_equal(s[:, 0], data[1, 0, 1]) @@ -151,3 +153,26 @@ def test_is_nifti_spheres_masker_give_nans(): # When mask_img is provided, the seed interacts within the brain, so no nan masker = NiftiSpheresMasker(seeds=seed, radius=2., mask_img=mask_img) assert_false(np.isnan(np.sum(masker.fit_transform(img)))) + + +def test_standardization(): + data = np.random.random((3, 3, 3, 5)) + img = nibabel.Nifti1Image(data, np.eye(4)) + + # test zscore + masker = NiftiSpheresMasker([(1, 1, 1)], standardize='zscore') + # Test the fit + s = masker.fit_transform(img) + + np.testing.assert_almost_equal(s.mean(), 0) + np.testing.assert_almost_equal(s.std(), 1) + + # test psc + masker = NiftiSpheresMasker([(1, 1, 1)], standardize='psc') + # Test the fit + s = masker.fit_transform(img) + + np.testing.assert_almost_equal(s.mean(), 0) + np.testing.assert_almost_equal(s.ravel(), data[1, 1, 1] / + data[1, 1, 1].mean() * 100 - 100, + ) diff --git a/nilearn/masking.py b/nilearn/masking.py index 88d0453cff..6708151537 100644 --- a/nilearn/masking.py +++ b/nilearn/masking.py @@ -8,7 +8,7 @@ import numpy as np from scipy import ndimage -from sklearn.externals.joblib import Parallel, delayed +from nilearn._utils.compat import Parallel, delayed from . import _utils from .image import new_img_like diff --git a/nilearn/mass_univariate/permuted_least_squares.py b/nilearn/mass_univariate/permuted_least_squares.py index bf4e616bf6..91d3dda2bf 100644 --- a/nilearn/mass_univariate/permuted_least_squares.py +++ b/nilearn/mass_univariate/permuted_least_squares.py @@ -8,7 +8,7 @@ import numpy as np from scipy import linalg from sklearn.utils import check_random_state -import sklearn.externals.joblib as joblib +from nilearn._utils.compat import joblib def normalize_matrix_on_axis(m, axis=0): @@ -34,11 +34,11 @@ def normalize_matrix_on_axis(m, axis=0): ... normalize_matrix_on_axis) >>> X = np.array([[0, 4], [1, 0]]) >>> normalize_matrix_on_axis(X) - array([[ 0., 1.], - [ 1., 0.]]) + array([[0., 1.], + [1., 0.]]) >>> normalize_matrix_on_axis(X, axis=1) - array([[ 0., 1.], - [ 1., 0.]]) + array([[0., 1.], + [1., 0.]]) """ if m.ndim > 2: diff --git a/nilearn/plotting/__init__.py b/nilearn/plotting/__init__.py index bfa0b879e0..a47a92d3e2 100644 --- a/nilearn/plotting/__init__.py +++ b/nilearn/plotting/__init__.py @@ -53,5 +53,5 @@ def _set_mpl_backend(): 'show', 'plot_matrix', 'view_surf', 'view_img_on_surf', 'view_img', 'view_connectome', 'view_markers', 'find_parcellation_cut_coords', 'find_probabilistic_atlas_cut_coords', - 'plot_surf', 'plot_surf_stat_map', 'plot_surf_roi', + 'plot_surf', 'plot_surf_stat_map', 'plot_surf_roi' ] diff --git a/nilearn/plotting/cm.py b/nilearn/plotting/cm.py index 1c989f4caa..9ee553e664 100644 --- a/nilearn/plotting/cm.py +++ b/nilearn/plotting/cm.py @@ -38,16 +38,16 @@ def _pigtailed_cmap(cmap, swap_order=('green', 'red', 'blue')): orig_cdict = cmap._segmentdata.copy() cdict = dict() - cdict['green'] = [(0.5*(1-p), c1, c2) - for (p, c1, c2) in reversed(orig_cdict[swap_order[0]])] - cdict['blue'] = [(0.5*(1-p), c1, c2) - for (p, c1, c2) in reversed(orig_cdict[swap_order[1]])] - cdict['red'] = [(0.5*(1-p), c1, c2) - for (p, c1, c2) in reversed(orig_cdict[swap_order[2]])] + cdict['green'] = [(0.5 * (1 - p), c1, c2) + for (p, c1, c2) in reversed(orig_cdict[swap_order[0]])] + cdict['blue'] = [(0.5 * (1 - p), c1, c2) + for (p, c1, c2) in reversed(orig_cdict[swap_order[1]])] + cdict['red'] = [(0.5 * (1 - p), c1, c2) + for (p, c1, c2) in reversed(orig_cdict[swap_order[2]])] for color in ('red', 'green', 'blue'): - cdict[color].extend([(0.5*(1+p), c1, c2) - for (p, c1, c2) in orig_cdict[color]]) + cdict[color].extend([(0.5 * (1 + p), c1, c2) + for (p, c1, c2) in orig_cdict[color]]) return cdict @@ -149,19 +149,28 @@ def alpha_cmap(color, name='', alpha_min=0.5, alpha_max=1.): _cmaps_data['bwr'] = _colors.LinearSegmentedColormap.from_list( 'bwr', _bwr_data)._segmentdata.copy() + ################################################################################ # Build colormaps and their reverse. + +# backported and adapted from matplotlib since it's deprecated in 3.2 +def _revcmap(data): + data_r = {} + for key, val in data.items(): + data_r[key] = [(1.0 - x, y1, y0) for x, y0, y1 in reversed(val)] + return data_r + + _cmap_d = dict() for _cmapname in list(_cmaps_data.keys()): # needed as dict changes within loop _cmapname_r = _cmapname + '_r' _cmapspec = _cmaps_data[_cmapname] - _cmaps_data[_cmapname_r] = _cm.revcmap(_cmapspec) + _cmaps_data[_cmapname_r] = _revcmap(_cmapspec) _cmap_d[_cmapname] = _colors.LinearSegmentedColormap( - _cmapname, _cmapspec, _cm.LUTSIZE) + _cmapname, _cmapspec, _cm.LUTSIZE) _cmap_d[_cmapname_r] = _colors.LinearSegmentedColormap( - _cmapname_r, _cmaps_data[_cmapname_r], - _cm.LUTSIZE) + _cmapname_r, _cmaps_data[_cmapname_r], _cm.LUTSIZE) ################################################################################ # A few transparent colormaps @@ -212,13 +221,15 @@ def alpha_cmap(color, name='', alpha_min=0.5, alpha_max=1.): def dim_cmap(cmap, factor=.3, to_white=True): """ Dim a colormap to white, or to black. """ - assert factor >= 0 and factor <=1, ValueError( - 'Dimming factor must be larger than 0 and smaller than 1, %s was passed.' - % factor) + assert 0 <= factor <= 1, ValueError( + 'Dimming factor must be larger than 0 and smaller than 1, %s was ' + 'passed.' % factor) if to_white: - dimmer = lambda c: 1 - factor*(1-c) + def dimmer(c): + return 1 - factor * (1 - c) else: - dimmer = lambda c: factor*c + def dimmer(c): + return factor * c cdict = cmap._segmentdata.copy() for c_index, color in enumerate(('red', 'green', 'blue')): color_lst = list() @@ -227,19 +238,17 @@ def dim_cmap(cmap, factor=.3, to_white=True): cdict[color] = color_lst return _colors.LinearSegmentedColormap( - '%s_dimmed' % cmap.name, - cdict, - _cm.LUTSIZE) + '%s_dimmed' % cmap.name, cdict, _cm.LUTSIZE) def replace_inside(outer_cmap, inner_cmap, vmin, vmax): """ Replace a colormap by another inside a pair of values. """ assert vmin < vmax, ValueError('vmin must be smaller than vmax') - assert vmin >= 0, ValueError('vmin must be larger than 0, %s was passed.' - % vmin) - assert vmax <= 1, ValueError('vmax must be smaller than 1, %s was passed.' - % vmax) + assert vmin >= 0, ValueError('vmin must be larger than 0, %s was passed.' + % vmin) + assert vmax <= 1, ValueError('vmax must be smaller than 1, %s was passed.' + % vmax) outer_cdict = outer_cmap._segmentdata.copy() inner_cdict = inner_cmap._segmentdata.copy() @@ -257,7 +266,6 @@ def replace_inside(outer_cmap, inner_cmap, vmin, vmax): this_cdict['green'].append((p, g, g)) this_cdict['blue'].append((p, b, b)) - for c_index, color in enumerate(('red', 'green', 'blue')): color_lst = list() @@ -266,8 +274,9 @@ def replace_inside(outer_cmap, inner_cmap, vmin, vmax): break color_lst.append((value, c1, c2)) - color_lst.append((vmin, outer_cmap(vmin)[c_index], - inner_cmap(vmin)[c_index])) + color_lst.append((vmin, + outer_cmap(vmin)[c_index], + inner_cmap(vmin)[c_index])) for value, c1, c2 in inner_cdict[color]: if value <= vmin: @@ -276,8 +285,9 @@ def replace_inside(outer_cmap, inner_cmap, vmin, vmax): break color_lst.append((value, c1, c2)) - color_lst.append((vmax, inner_cmap(vmax)[c_index], - outer_cmap(vmax)[c_index])) + color_lst.append((vmax, + inner_cmap(vmax)[c_index], + outer_cmap(vmax)[c_index])) for value, c1, c2 in outer_cdict[color]: if value <= vmax: @@ -287,8 +297,5 @@ def replace_inside(outer_cmap, inner_cmap, vmin, vmax): cdict[color] = color_lst return _colors.LinearSegmentedColormap( - '%s_inside_%s' % (inner_cmap.name, outer_cmap.name), - cdict, - _cm.LUTSIZE) - - + '%s_inside_%s' % (inner_cmap.name, outer_cmap.name), + cdict, _cm.LUTSIZE) diff --git a/nilearn/plotting/data/html/connectome_plot_template.html b/nilearn/plotting/data/html/connectome_plot_template.html index 9fe2adfaca..11e592a173 100644 --- a/nilearn/plotting/data/html/connectome_plot_template.html +++ b/nilearn/plotting/data/html/connectome_plot_template.html @@ -25,6 +25,14 @@ data.push(info); let layout = getLayout("connectome-plot", "select-view", false); + + layout['title'] = { + text: connectomeInfo['connectome']['title'], + font: {size: connectomeInfo['connectome']["title_fontsize"], + color: textColor(connectomeInfo["black_bg"])}, + yref: 'paper', + y: .9}; + let config = getConfig(); Plotly.plot(divId, data, layout, config); @@ -47,7 +55,8 @@ "select-view", false), getConfig(), connectomeInfo["connectome"]["cbar_fontsize"], - connectomeInfo["connectome"]["cbar_height"]); + connectomeInfo["connectome"]["cbar_height"], + textColor(connectomeInfo["black_bg"])); } } diff --git a/nilearn/plotting/data/html/surface_plot_template.html b/nilearn/plotting/data/html/surface_plot_template.html index 9854b5a6d8..ba56e986fe 100644 --- a/nilearn/plotting/data/html/surface_plot_template.html +++ b/nilearn/plotting/data/html/surface_plot_template.html @@ -22,6 +22,12 @@ info['lighting'] = getLighting(); let layout = getLayout("surface-plot", "select-view", surfaceMapInfo["black_bg"]); + layout['title'] = { + text: surfaceMapInfo['title'], + font: {size: surfaceMapInfo["title_fontsize"], + color: textColor(surfaceMapInfo["black_bg"])}, + yref: 'paper', + y: .95}; let config = getConfig(); Plotly.react(divId, data, layout, config); @@ -32,7 +38,8 @@ surfaceMapInfo["cmax"], divId, layout, config, surfaceMapInfo["cbar_fontsize"], - surfaceMapInfo["cbar_height"]); + surfaceMapInfo["cbar_height"], + color=textColor(surfaceMapInfo["black_bg"])); } } diff --git a/nilearn/plotting/data/js/plotly-gl3d-latest.min.js b/nilearn/plotting/data/js/plotly-gl3d-latest.min.js index 2c2af6e989..2c8865bef8 100644 --- a/nilearn/plotting/data/js/plotly-gl3d-latest.min.js +++ b/nilearn/plotting/data/js/plotly-gl3d-latest.min.js @@ -1,7 +1,7 @@ /** -* plotly.js (gl3d - minified) v1.38.3 -* Copyright 2012-2018, Plotly, Inc. +* plotly.js (gl3d - minified) v1.46.1 +* Copyright 2012-2019, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=t()}}(function(){return function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;oMath.abs(e))u.rotate(o,0,0,-t*i*Math.PI*p.rotateSpeed/window.innerWidth);else{var s=p.zoomSpeed*a*e/window.innerHeight*(o-u.lastT())/100;u.pan(o,0,0,f*(Math.exp(s)-1))}},!0),p};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset"),l=t("has-passive-events")},{"3d-view":10,"has-passive-events":232,"mouse-change":250,"mouse-event-offset":251,"mouse-wheel":253,"right-now":295}],10:[function(t,e,r){"use strict";e.exports=function(t){var e=(t=t||{}).eye||[0,0,1],r=t.center||[0,0,0],s=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=n(),f=i(),h=a();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,s),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,s),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,s),new o({turntable:c,orbit:f,matrix:h},u)};var n=t("turntable-camera-controller"),i=t("orbit-camera-controller"),a=t("matrix-camera-controller");function o(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}var s=o.prototype;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].forEach(function(t){for(var e=t[0],r=[],n=0;n0?l-4:l;var c=0;for(e=0;e>16&255,s[c++]=n>>8&255,s[c++]=255&n;2===o?(n=i[t.charCodeAt(e)]<<2|i[t.charCodeAt(e+1)]>>4,s[c++]=255&n):1===o&&(n=i[t.charCodeAt(e)]<<10|i[t.charCodeAt(e+1)]<<4|i[t.charCodeAt(e+2)]>>2,s[c++]=n>>8&255,s[c++]=255&n);return s},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,a="",o=[],s=0,l=r-i;sl?l:s+16383));1===i?(e=t[r-1],a+=n[e>>2],a+=n[e<<4&63],a+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],a+=n[e>>10],a+=n[e>>4&63],a+=n[e<<2&63],a+="=");return o.push(a),o.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function c(t,e,r){for(var i,a,o=[],s=e;s>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],19:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}},{"./lib/rationalize":29}],20:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],21:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]),t[1].mul(e[0]))}},{"./lib/rationalize":29}],22:[function(t,e,r){"use strict";var n=t("./is-rat"),i=t("./lib/is-bn"),a=t("./lib/num-to-bn"),o=t("./lib/str-to-bn"),s=t("./lib/rationalize"),l=t("./div");e.exports=function t(e,r){if(n(e))return r?l(e,t(r)):[e[0].clone(),e[1].clone()];var u=0;var c,f;if(i(e))c=e.clone();else if("string"==typeof e)c=o(e);else{if(0===e)return[a(0),a(1)];if(e===Math.floor(e))c=a(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),u-=256;c=a(e)}}if(n(r))c.mul(r[1]),f=r[0].clone();else if(i(r))f=r.clone();else if("string"==typeof r)f=o(r);else if(r)if(r===Math.floor(r))f=a(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),u+=256;f=a(r)}else f=a(1);u>0?c=c.ushln(u):u<0&&(f=f.ushln(-u));return s(c,f)}},{"./div":21,"./is-rat":23,"./lib/is-bn":27,"./lib/num-to-bn":28,"./lib/rationalize":29,"./lib/str-to-bn":30}],23:[function(t,e,r){"use strict";var n=t("./lib/is-bn");e.exports=function(t){return Array.isArray(t)&&2===t.length&&n(t[0])&&n(t[1])}},{"./lib/is-bn":27}],24:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":37}],25:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=function(t){var e=t.length,r=t.words,i=0;if(1===e)i=r[0];else if(2===e)i=r[0]+67108864*r[1];else for(var a=0;a20)return 52;return r+32}},{"bit-twiddle":36,"double-bits":83}],27:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":37}],28:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("double-bits");e.exports=function(t){var e=i.exponent(t);return e<52?new n(t):new n(t*Math.pow(2,52-e)).ushln(e-52)}},{"bn.js":37,"double-bits":83}],29:[function(t,e,r){"use strict";var n=t("./num-to-bn"),i=t("./bn-sign");e.exports=function(t,e){var r=i(t),a=i(e);if(0===r)return[n(0),n(1)];if(0===a)return[n(0),n(0)];a<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);if(o.cmpn(1))return[t.div(o),e.div(o)];return[t,e]}},{"./bn-sign":24,"./num-to-bn":28}],30:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":37}],31:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[0]),t[1].mul(e[1]))}},{"./lib/rationalize":29}],32:[function(t,e,r){"use strict";var n=t("./lib/bn-sign");e.exports=function(t){return n(t[0])*n(t[1])}},{"./lib/bn-sign":24}],33:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}},{"./lib/rationalize":29}],34:[function(t,e,r){"use strict";var n=t("./lib/bn-to-num"),i=t("./lib/ctz");e.exports=function(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var a=e.abs().divmod(r.abs()),o=a.div,s=n(o),l=a.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=i(s)+4,f=n(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}var h=r.bitLength()-l.bitLength()+53,f=n(l.ushln(h).divRound(r));return h<1023?u*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),u*f*Math.pow(2,1023-h))}},{"./lib/bn-to-num":25,"./lib/ctz":26}],35:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=["function ",t,"(a,l,h,",n.join(","),"){",a?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return a?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),a?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],36:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,e|=r=((t>>>=e)>255)<<3,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},r.deinterleave2=function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},r.interleave3=function(t,e,r){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},r.deinterleave3=function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],37:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;try{o=t("buffer").Buffer}catch(t){}function s(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function l(t,e,r,n){for(var i=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return i}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=s(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,s=Math.min(a,a-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&l,h=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=h;d++){var p=u-d|0;c+=(o=(i=0|t.words[p])*(a=0|e.words[d])+f)/67108864|0,f=67108863&o}r.words[u]=0|f,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,a=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=c[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:u[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(a),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,g=d>>>13,v=0|o[2],m=8191&v,y=v>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],M=8191&w,A=w>>>13,T=0|o[5],k=8191&T,E=T>>>13,S=0|o[6],L=8191&S,C=S>>>13,P=0|o[7],O=8191&P,R=P>>>13,I=0|o[8],N=8191&I,z=I>>>13,D=0|o[9],F=8191&D,j=D>>>13,B=0|s[0],U=8191&B,V=B>>>13,H=0|s[1],q=8191&H,G=H>>>13,X=0|s[2],W=8191&X,Y=X>>>13,Z=0|s[3],Q=8191&Z,J=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ft=8191&ct,ht=ct>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(u+(n=Math.imul(f,U))|0)+((8191&(i=(i=Math.imul(f,V))+Math.imul(h,U)|0))<<13)|0;u=((a=Math.imul(h,V))+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,V))+Math.imul(g,U)|0,a=Math.imul(g,V);var mt=(u+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(h,q)|0))<<13)|0;u=((a=a+Math.imul(h,G)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,U),i=(i=Math.imul(m,V))+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,q)|0,a=a+Math.imul(g,G)|0;var yt=(u+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(h,W)|0))<<13)|0;u=((a=a+Math.imul(h,Y)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,V))+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(m,q)|0,i=(i=i+Math.imul(m,G)|0)+Math.imul(y,q)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,W)|0,a=a+Math.imul(g,Y)|0;var bt=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(h,Q)|0))<<13)|0;u=((a=a+Math.imul(h,J)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=(i=Math.imul(M,V))+Math.imul(A,U)|0,a=Math.imul(A,V),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(_,q)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(y,W)|0,a=a+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,J)|0;var xt=(u+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(h,$)|0))<<13)|0;u=((a=a+Math.imul(h,tt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(k,U),i=(i=Math.imul(k,V))+Math.imul(E,U)|0,a=Math.imul(E,V),n=n+Math.imul(M,q)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(A,q)|0,a=a+Math.imul(A,G)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(_,W)|0,a=a+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,J)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,J)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,a=a+Math.imul(g,tt)|0;var _t=(u+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(h,rt)|0))<<13)|0;u=((a=a+Math.imul(h,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(L,U),i=(i=Math.imul(L,V))+Math.imul(C,U)|0,a=Math.imul(C,V),n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(E,q)|0,a=a+Math.imul(E,G)|0,n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(A,W)|0,a=a+Math.imul(A,Y)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,J)|0,n=n+Math.imul(m,$)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,nt)|0;var wt=(u+(n=n+Math.imul(f,at)|0)|0)+((8191&(i=(i=i+Math.imul(f,ot)|0)+Math.imul(h,at)|0))<<13)|0;u=((a=a+Math.imul(h,ot)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(O,U),i=(i=Math.imul(O,V))+Math.imul(R,U)|0,a=Math.imul(R,V),n=n+Math.imul(L,q)|0,i=(i=i+Math.imul(L,G)|0)+Math.imul(C,q)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(E,W)|0,a=a+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(A,Q)|0,a=a+Math.imul(A,J)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(_,$)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(p,at)|0,i=(i=i+Math.imul(p,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0;var Mt=(u+(n=n+Math.imul(f,lt)|0)|0)+((8191&(i=(i=i+Math.imul(f,ut)|0)+Math.imul(h,lt)|0))<<13)|0;u=((a=a+Math.imul(h,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(N,U),i=(i=Math.imul(N,V))+Math.imul(z,U)|0,a=Math.imul(z,V),n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(R,q)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(L,W)|0,i=(i=i+Math.imul(L,Y)|0)+Math.imul(C,W)|0,a=a+Math.imul(C,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,J)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(A,$)|0,a=a+Math.imul(A,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(m,at)|0,i=(i=i+Math.imul(m,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(g,lt)|0,a=a+Math.imul(g,ut)|0;var At=(u+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(h,ft)|0))<<13)|0;u=((a=a+Math.imul(h,ht)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,V))+Math.imul(j,U)|0,a=Math.imul(j,V),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(z,q)|0,a=a+Math.imul(z,G)|0,n=n+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(R,W)|0,a=a+Math.imul(R,Y)|0,n=n+Math.imul(L,Q)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,J)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,tt)|0,n=n+Math.imul(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(A,rt)|0,a=a+Math.imul(A,nt)|0,n=n+Math.imul(x,at)|0,i=(i=i+Math.imul(x,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(m,lt)|0,i=(i=i+Math.imul(m,ut)|0)+Math.imul(y,lt)|0,a=a+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ft)|0,a=a+Math.imul(g,ht)|0;var Tt=(u+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,gt)|0)+Math.imul(h,pt)|0))<<13)|0;u=((a=a+Math.imul(h,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,q),i=(i=Math.imul(F,G))+Math.imul(j,q)|0,a=Math.imul(j,G),n=n+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(z,W)|0,a=a+Math.imul(z,Y)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(R,Q)|0,a=a+Math.imul(R,J)|0,n=n+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(C,$)|0,a=a+Math.imul(C,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,nt)|0,n=n+Math.imul(M,at)|0,i=(i=i+Math.imul(M,ot)|0)+Math.imul(A,at)|0,a=a+Math.imul(A,ot)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(_,lt)|0,a=a+Math.imul(_,ut)|0,n=n+Math.imul(m,ft)|0,i=(i=i+Math.imul(m,ht)|0)+Math.imul(y,ft)|0,a=a+Math.imul(y,ht)|0;var kt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;u=((a=a+Math.imul(g,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,W),i=(i=Math.imul(F,Y))+Math.imul(j,W)|0,a=Math.imul(j,Y),n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,J)|0)+Math.imul(z,Q)|0,a=a+Math.imul(z,J)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,tt)|0,n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(C,rt)|0,a=a+Math.imul(C,nt)|0,n=n+Math.imul(k,at)|0,i=(i=i+Math.imul(k,ot)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,n=n+Math.imul(M,lt)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(A,lt)|0,a=a+Math.imul(A,ut)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(_,ft)|0,a=a+Math.imul(_,ht)|0;var Et=(u+(n=n+Math.imul(m,pt)|0)|0)+((8191&(i=(i=i+Math.imul(m,gt)|0)+Math.imul(y,pt)|0))<<13)|0;u=((a=a+Math.imul(y,gt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,J))+Math.imul(j,Q)|0,a=Math.imul(j,J),n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(z,$)|0,a=a+Math.imul(z,tt)|0,n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,nt)|0,n=n+Math.imul(L,at)|0,i=(i=i+Math.imul(L,ot)|0)+Math.imul(C,at)|0,a=a+Math.imul(C,ot)|0,n=n+Math.imul(k,lt)|0,i=(i=i+Math.imul(k,ut)|0)+Math.imul(E,lt)|0,a=a+Math.imul(E,ut)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,ft)|0,a=a+Math.imul(A,ht)|0;var St=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((a=a+Math.imul(_,gt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,$),i=(i=Math.imul(F,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(z,rt)|0,a=a+Math.imul(z,nt)|0,n=n+Math.imul(O,at)|0,i=(i=i+Math.imul(O,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,n=n+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ut)|0)+Math.imul(C,lt)|0,a=a+Math.imul(C,ut)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(E,ft)|0,a=a+Math.imul(E,ht)|0;var Lt=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,gt)|0)+Math.imul(A,pt)|0))<<13)|0;u=((a=a+Math.imul(A,gt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(j,rt)|0,a=Math.imul(j,nt),n=n+Math.imul(N,at)|0,i=(i=i+Math.imul(N,ot)|0)+Math.imul(z,at)|0,a=a+Math.imul(z,ot)|0,n=n+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ut)|0)+Math.imul(R,lt)|0,a=a+Math.imul(R,ut)|0,n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul(C,ft)|0,a=a+Math.imul(C,ht)|0;var Ct=(u+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,gt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((a=a+Math.imul(E,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,at),i=(i=Math.imul(F,ot))+Math.imul(j,at)|0,a=Math.imul(j,ot),n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ut)|0)+Math.imul(z,lt)|0,a=a+Math.imul(z,ut)|0,n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(R,ft)|0,a=a+Math.imul(R,ht)|0;var Pt=(u+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,gt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((a=a+Math.imul(C,gt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,lt),i=(i=Math.imul(F,ut))+Math.imul(j,lt)|0,a=Math.imul(j,ut),n=n+Math.imul(N,ft)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(z,ft)|0,a=a+Math.imul(z,ht)|0;var Ot=(u+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,gt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((a=a+Math.imul(R,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(F,ft),i=(i=Math.imul(F,ht))+Math.imul(j,ft)|0,a=Math.imul(j,ht);var Rt=(u+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(z,pt)|0))<<13)|0;u=((a=a+Math.imul(z,gt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,gt))+Math.imul(j,pt)|0))<<13)|0;return u=((a=Math.imul(j,gt))+(i>>>13)|0)+(It>>>26)|0,It&=67108863,l[0]=vt,l[1]=mt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=At,l[9]=Tt,l[10]=kt,l[11]=Et,l[12]=St,l[13]=Lt,l[14]=Ct,l[15]=Pt,l[16]=Ot,l[17]=Rt,l[18]=It,0!==u&&(l[19]=u,r.length++),r};function p(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(d=h),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?h(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var f=0|this.words[u];this.words[u]=c<<26-a|f>>>a,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){(s=new a(null)).length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new a(1),s=new a(0),l=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(e.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(l),o.iushrn(1);for(var f=0,h=1;0==(r.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(i=0===e.cmpn(1)?o:s).cmpn(0)<0&&i.iadd(t),i},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new w(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}m.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(y,m),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new x;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},w.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,i),h=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var g=d,v=0;0!==g.cmp(s);v++)g=g.redSqr();n(v=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var f=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},i(M,w),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:46}],38:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i=t.length,a=0;for(e=0;e>>1;if(!(c<=0)){var f,h=i.mallocDouble(2*c*s),d=i.mallocInt32(s);if((s=l(t,c,h,d))>0){if(1===c&&n)a.init(s),f=a.sweepComplete(c,r,0,s,h,d,0,s,h,d);else{var p=i.mallocDouble(2*c*u),g=i.mallocInt32(u);(u=l(e,c,p,g))>0&&(a.init(s+u),f=1===c?a.sweepBipartite(c,r,0,s,h,d,0,u,p,g):o(c,r,n,s,h,d,u,p,g),i.free(p),i.free(g))}i.free(h),i.free(d)}return f}}}function c(t,e){n.push([t,e])}},{"./lib/intersect":41,"./lib/sweep":45,"typedarray-pool":328}],40:[function(t,e,r){"use strict";var n="d",i="ax",a="vv",o="fp",s="es",l="rs",u="re",c="rb",f="ri",h="rp",d="bs",p="be",g="bb",v="bi",m="bp",y="rv",b="Q",x=[n,i,a,l,u,c,f,d,p,g,v];function _(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],_=x.slice();t||_.splice(3,0,o);var w=["function "+e+"("+_.join()+"){"];function M(e,o){var _=function(t,e,r){var o="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),_=["function ",o,"(",x.join(),"){","var ",s,"=2*",n,";"],w="for(var i="+l+","+h+"="+s+"*"+l+";i<"+u+";++i,"+h+"+="+s+"){var x0="+c+"["+i+"+"+h+"],x1="+c+"["+i+"+"+h+"+"+n+"],xi="+f+"[i];",M="for(var j="+d+","+m+"="+s+"*"+d+";j<"+p+";++j,"+m+"+="+s+"){var y0="+g+"["+i+"+"+m+"],"+(r?"y1="+g+"["+i+"+"+m+"+"+n+"],":"")+"yi="+v+"[j];";return t?_.push(w,b,":",M):_.push(M,b,":",w),r?_.push("if(y1"+p+"-"+d+"){"),t?(M(!0,!1),w.push("}else{"),M(!1,!1)):(w.push("if("+o+"){"),M(!0,!0),w.push("}else{"),M(!0,!1),w.push("}}else{if("+o+"){"),M(!1,!0),w.push("}else{"),M(!1,!1),w.push("}")),w.push("}}return "+e);var A=r.join("")+w.join("");return new Function(A)()}r.partial=_(!1),r.full=_(!0)},{}],41:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,c,E,S,L,C){!function(t,e){var r=8*i.log2(e+1)*(t+1)|0,a=i.nextPow2(x*r);w.length0;){var I=(O-=1)*x,N=w[I],z=w[I+1],D=w[I+2],F=w[I+3],j=w[I+4],B=w[I+5],U=O*_,V=M[U],H=M[U+1],q=1&B,G=!!(16&B),X=c,W=E,Y=L,Z=C;if(q&&(X=L,W=C,Y=c,Z=E),!(2&B&&(D=v(t,N,z,D,X,W,H),z>=D)||4&B&&(z=m(t,N,z,D,X,W,V))>=D)){var Q=D-z,J=j-F;if(G){if(t*Q*(Q+J)=p0)&&!(p1>=hi)",["p0","p1"]),g=c("lo===p0",["p0"]),v=c("lo>>1,h=2*t,d=f,p=s[h*f+e];for(;u=b?(d=y,p=b):m>=_?(d=v,p=m):(d=x,p=_):b>=_?(d=y,p=b):_>=m?(d=v,p=m):(d=x,p=_);for(var w=h*(c-1),M=h*d,A=0;Ar&&i[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p=0&&i.push("lo=e[k+n]");t.indexOf("hi")>=0&&i.push("hi=e[k+o]");return r.push(n.replace("_",i.join()).replace("$",t)),Function.apply(void 0,r)};var n="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],44:[function(t,e,r){"use strict";e.exports=function(t,e){e<=4*n?i(0,e-1,t):function t(e,r,f){var h=(r-e+1)/6|0,d=e+h,p=r-h,g=e+r>>1,v=g-h,m=g+h,y=d,b=v,x=g,_=m,w=p,M=e+1,A=r-1,T=0;u(y,b,f)&&(T=y,y=b,b=T);u(_,w,f)&&(T=_,_=w,w=T);u(y,x,f)&&(T=y,y=x,x=T);u(b,x,f)&&(T=b,b=x,x=T);u(y,_,f)&&(T=y,y=_,_=T);u(x,_,f)&&(T=x,x=_,_=T);u(b,w,f)&&(T=b,b=w,w=T);u(b,x,f)&&(T=b,b=x,x=T);u(_,w,f)&&(T=_,_=w,w=T);var k=f[2*b];var E=f[2*b+1];var S=f[2*_];var L=f[2*_+1];var C=2*y;var P=2*x;var O=2*w;var R=2*d;var I=2*g;var N=2*p;for(var z=0;z<2;++z){var D=f[C+z],F=f[P+z],j=f[O+z];f[R+z]=D,f[I+z]=F,f[N+z]=j}o(v,e,f);o(m,r,f);for(var B=M;B<=A;++B)if(c(B,k,E,f))B!==M&&a(B,M,f),++M;else if(!c(B,S,L,f))for(;;){if(c(A,S,L,f)){c(A,k,E,f)?(s(B,M,A,f),++M,--A):(a(B,A,f),--A);break}if(--At;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){var i=n[t*=2];return i>>1;a(d,E);for(var S=0,L=0,M=0;M=o)p(u,c,L--,C=C-o|0);else if(C>=0)p(s,l,S--,C);else if(C<=-o){C=-C-o|0;for(var P=0;P>>1;a(d,S);for(var L=0,C=0,P=0,A=0;A>1==d[2*A+3]>>1&&(R=2,A+=1),O<0){for(var I=-(O>>1)-1,N=0;N>1)-1;0===R?p(s,l,L--,I):1===R?p(u,c,C--,I):2===R&&p(f,h,P--,I)}}},scanBipartite:function(t,e,r,n,i,u,c,f,h,v,m,y){var b=0,x=2*t,_=e,w=e+t,M=1,A=1;n?A=o:M=o;for(var T=i;T>>1;a(d,L);for(var C=0,T=0;T=o?(O=!n,k-=o):(O=!!n,k-=1),O)g(s,l,C++,k);else{var R=y[k],I=x*k,N=m[I+e+1],z=m[I+e+1+t];t:for(var D=0;D>>1;a(d,M);for(var A=0,b=0;b=o)s[A++]=x-o;else{var k=p[x-=1],E=v*x,S=h[E+e+1],L=h[E+e+1+t];t:for(var C=0;C=0;--C)if(s[C]===x){for(var I=C+1;Ia)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(t)}return l(t,e,r)}function l(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return B(t)||t&&B(t.buffer)?function(t,e,r){if(e<0||t.byteLength=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return D(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),U(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var a,o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}function u(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var c=-1;for(a=r;as&&(r=s-l),a=r;a>=0;a--){for(var f=!0,h=0;hi&&(n=i):n=i;var a=e.length;n>a/2&&(n=a/2);for(var o=0;o>8,i=r%256,a.push(i),a.push(n);return a}(e,t.length-r),t,r,n)}function M(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+f<=r)switch(f){case 1:u<128&&(c=u);break;case 2:128==(192&(a=t[i+1]))&&(l=(31&u)<<6|63&a)>127&&(c=l);break;case 3:a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&(l=(15&u)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return E(this,e,r);case"base64":return M(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(e>>>=0),l=Math.min(a,o),u=this.slice(n,i),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return y(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,a){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function O(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,a){return e=+e,r>>>=0,a||O(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function I(t,e,r,n,a){return e=+e,r>>>=0,a||O(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*e)),a},s.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||C(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return I(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return I(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function B(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function U(t){return t!=t}},{"base64-js":18,ieee754:233}],48:[function(t,e,r){"use strict";var n=t("./lib/monotone"),i=t("./lib/triangulation"),a=t("./lib/delaunay"),o=t("./lib/filter");function s(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function l(t,e){return t[0]-e[0]||t[1]-e[1]}function u(t,e,r){return e in t?t[e]:r}e.exports=function(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var c=!!u(r,"delaunay",!0),f=!!u(r,"interior",!0),h=!!u(r,"exterior",!0),d=!!u(r,"infinity",!1);if(!f&&!h||0===t.length)return[];var p=n(t,e);if(c||f!==h||d){for(var g=i(t.length,function(t){return t.map(s).sort(l)}(e)),v=0;v0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),i(t,e,r,f,s,h),i(t,e,r,s,h,f),i(t,e,r,h,c,f),i(t,e,r,c,f,h)))}}},{"binary-search-bounds":53,"robust-in-sphere":299}],50:[function(t,e,r){"use strict";var n,i=t("binary-search-bounds");function a(t,e,r,n,i,a,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=a,this.boundary=o}function o(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}e.exports=function(t,e,r){var n=function(t,e){for(var r=t.cells(),n=r.length,i=0;i0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;c[d];for(var p=0;p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var m=function(t,e,r){for(var n=0,i=0;i1&&i(r[h[d-2]],r[h[d-1]],a)>0;)t.push([h[d-1],h[d-2],o]),d-=1;h.length=d,h.push(o);var p=c.upperIds;for(d=p.length;d>1&&i(r[p[d-2]],r[p[d-1]],a)<0;)t.push([p[d-2],p[d-1],o]),d-=1;p.length=d,p.push(o)}}function d(t,e){var r;return(r=t.a[0]m[0]&&i.push(new u(m,v,s,f),new u(v,m,o,f))}i.sort(c);for(var y=i[0].a[0]-(1+Math.abs(i[0].a[0]))*Math.pow(2,-52),b=[new l([y,1],[y,0],-1,[],[],[],[])],x=[],f=0,_=i.length;f<_;++f){var w=i[f],M=w.type;M===a?h(x,b,t,w.a,w.idx):M===s?p(b,t,w):g(b,t,w)}return x}},{"binary-search-bounds":53,"robust-orientation":301}],52:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function i(t,e){this.stars=t,this.edges=e}e.exports=function(t,e){for(var r=new Array(t),n=0;n=0}}(),a.removeTriangle=function(t,e,r){var n=this.stars;o(n[t],e,r),o(n[e],r,t),o(n[r],t,e)},a.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},a.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;n>>1,x=a[m]"];return i?e.indexOf("c")<0?a.push(";if(x===y){return m}else if(x<=y){"):a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):a.push(";if(",e,"){i=m;"),r?a.push("l=m+1}else{h=m-1}"):a.push("h=m-1}else{l=m+1}"),a.push("}"),i?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],54:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1,r=1;rr?r:t:te?e:t}},{}],58:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;ae[2]?1:0)}function m(t,e,r){if(0!==t.length){if(e)for(var n=0;n=0;--a){var b=e[c=(E=n[a])[0]],x=b[0],_=b[1],w=t[x],M=t[_];if((w[0]-M[0]||w[1]-M[1])<0){var A=x;x=_,_=A}b[0]=x;var T,k=b[1]=E[1];for(i&&(T=b[2]);a>0&&n[a-1][0]===c;){var E,S=(E=n[--a])[1];i?e.push([k,S,T]):e.push([k,S]),k=S}i?e.push([k,_,T]):e.push([k,_])}return h}(t,e,h,v,r));return m(e,y,r),!!y||(h.length>0||v.length>0)}},{"./lib/rat-seg-intersect":59,"big-rat":22,"big-rat/cmp":20,"big-rat/to-float":34,"box-intersect":39,nextafter:266,"rat-vec":290,"robust-segment-intersect":304,"union-find":329}],59:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=s(e,t),f=s(n,r),h=c(a,f);if(0===o(h))return null;var d=s(t,r),p=c(f,d),g=i(p,h),v=u(a,g);return l(t,v)};var n=t("big-rat/mul"),i=t("big-rat/div"),a=t("big-rat/sub"),o=t("big-rat/sign"),s=t("rat-vec/sub"),l=t("rat-vec/add"),u=t("rat-vec/muls");function c(t,e){return a(n(t[0],e[1]),n(t[1],e[0]))}},{"big-rat/div":21,"big-rat/mul":31,"big-rat/sign":32,"big-rat/sub":33,"rat-vec/add":289,"rat-vec/muls":291,"rat-vec/sub":292}],60:[function(t,e,r){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],61:[function(t,e,r){"use strict";var n=t("color-rgba"),i=t("clamp"),a=t("dtype");e.exports=function(t,e){"float"!==e&&e||(e="array"),"uint"===e&&(e="uint8"),"uint_clamped"===e&&(e="uint8_clamped");var r=a(e),o=new r(4);if(t instanceof r)return Array.isArray(t)?t.slice():(o.set(t),o);var s="uint8"!==e&&"uint8_clamped"!==e;return t instanceof Uint8Array||t instanceof Uint8ClampedArray?(o[0]=t[0],o[1]=t[1],o[2]=t[2],o[3]=null!=t[3]?t[3]:255,s&&(o[0]/=255,o[1]/=255,o[2]/=255,o[3]/=255),o):(t.length&&"string"!=typeof t||((t=n(t))[0]/=255,t[1]/=255,t[2]/=255),s?(o[0]=t[0],o[1]=t[1],o[2]=t[2],o[3]=null!=t[3]?t[3]:1):(o[0]=i(Math.round(255*t[0]),0,255),o[1]=i(Math.round(255*t[1]),0,255),o[2]=i(Math.round(255*t[2]),0,255),o[3]=null==t[3]?255:i(Math.floor(255*t[3]),0,255)),o)}},{clamp:57,"color-rgba":63,dtype:84}],62:[function(t,e,r){(function(r){"use strict";var n=t("color-name"),i=t("is-plain-obj"),a=t("defined");e.exports=function(t){var e,s,l=[],u=1;if("string"==typeof t)if(n[t])l=n[t].slice(),s="rgb";else if("transparent"===t)u=0,s="rgb",l=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var c=t.slice(1),f=c.length,h=f<=4;u=1,h?(l=[parseInt(c[0]+c[0],16),parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16)],4===f&&(u=parseInt(c[3]+c[3],16)/255)):(l=[parseInt(c[0]+c[1],16),parseInt(c[2]+c[3],16),parseInt(c[4]+c[5],16)],8===f&&(u=parseInt(c[6]+c[7],16)/255)),l[0]||(l[0]=0),l[1]||(l[1]=0),l[2]||(l[2]=0),s="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var d=e[1],c=d.replace(/a$/,"");s=c;var f="cmyk"===c?4:"gray"===c?1:3;l=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===f?parseFloat(t)/100:"rgb"===c?255*parseFloat(t)/100:parseFloat(t);if("h"===c[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),d===c&&l.push(1),u=void 0===l[f]?1:l[f],l=l.slice(0,f)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(l=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),s=t.match(/([a-z])/ig).join("").toLowerCase());else if("number"==typeof t)s="rgb",l=[t>>>16,(65280&t)>>>8,255&t];else if(i(t)){var p=a(t.r,t.red,t.R,null);null!==p?(s="rgb",l=[p,a(t.g,t.green,t.G),a(t.b,t.blue,t.B)]):(s="hsl",l=[a(t.h,t.hue,t.H),a(t.s,t.saturation,t.S),a(t.l,t.lightness,t.L,t.b,t.brightness)]),u=a(t.a,t.alpha,t.opacity,1),null!=t.opacity&&(u/=100)}else(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(l=[t[0],t[1],t[2]],s="rgb",u=4===t.length?t[3]:1);return{space:s,values:l,alpha:u}};var o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":60,defined:81,"is-plain-obj":241}],63:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t){var e;if("string"!=typeof t)throw Error("Argument should be a string");var r=n(t);return r.space?((e=Array(3))[0]=a(r.values[0],0,255),e[1]=a(r.values[1],0,255),e[2]=a(r.values[2],0,255),"h"===r.space[0]&&(e=i.rgb(e)),e.push(a(r.alpha,0,1)),e):[]}},{clamp:57,"color-parse":62,"color-space/hsl":64}],64:[function(t,e,r){"use strict";var n=t("./rgb");e.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,r,n,i,a,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[a=255*l,a,a];e=2*l-(r=l<.5?l*(1+s):l+s-l*s),i=[0,0,0];for(var u=0;u<3;u++)(n=o+1/3*-(u-1))<0?n++:n>1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n=t[0]/255,i=t[1]/255,a=t[2]/255,o=Math.min(n,i,a),s=Math.max(n,i,a),l=s-o;return s===o?e=0:n===s?e=(i-a)/l:i===s?e=2+(a-n)/l:a===s&&(e=4+(n-i)/l),(e=Math.min(60*e,360))<0&&(e+=360),r=(o+s)/2,[e,100*(s===o?0:r<=.5?l/(s+o):l/(2-s-o)),100*r]}},{"./rgb":65}],65:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],66:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:1,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],67:[function(t,e,r){"use strict";var n=t("./colorScale"),i=t("lerp");function a(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]]}function o(t){for(var e,r="#",n=0;n<3;++n)r+=("00"+(e=(e=t[n]).toString(16))).substr(e.length);return r}function s(t){return"rgba("+t.join(",")+")"}e.exports=function(t){var e,r,l,u,c,f,h,d,p,g;t||(t={});d=(t.nshades||72)-1,h=t.format||"hex",(f=t.colormap)||(f="jet");if("string"==typeof f){if(f=f.toLowerCase(),!n[f])throw Error(f+" not a supported colorscale");c=n[f]}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);c=f.slice()}if(c.length>d)throw new Error(f+" map requires nshades to be at least size "+c.length);p=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:t.alpha.slice():"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1];e=c.map(function(t){return Math.round(t.index*d)}),p[0]=Math.min(Math.max(p[0],0),1),p[1]=Math.min(Math.max(p[1],0),1);var v=c.map(function(t,e){var r=c[e].index,n=c[e].rgb.slice();return 4===n.length&&n[3]>=0&&n[3]<=1?n:(n[3]=p[0]+(p[1]-p[0])*r,n)}),m=[];for(g=0;g0?-1:l(t,e,a)?-1:1:0===s?u>0?1:l(t,e,r)?1:-1:i(u-s)}var h=n(t,e,r);if(h>0)return o>0&&n(t,e,a)>0?1:-1;if(h<0)return o>0||n(t,e,a)>0?1:-1;var d=n(t,e,a);return d>0?1:l(t,e,r)?1:-1};var n=t("robust-orientation"),i=t("signum"),a=t("two-sum"),o=t("robust-product"),s=t("robust-sum");function l(t,e,r){var n=a(t[0],-e[0]),i=a(t[1],-e[1]),l=a(r[0],-e[0]),u=a(r[1],-e[1]),c=s(o(n,l),o(i,u));return c[c.length-1]>=0}},{"robust-orientation":301,"robust-product":302,"robust-sum":306,signum:307,"two-sum":327}],69:[function(t,e,r){e.exports=function(t,e){var r=t.length,a=t.length-e.length;if(a)return a;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||n(t[0],t[1])-n(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(a=o+t[2]-(s+e[2]))return a;var l=n(t[0],t[1]),u=n(e[0],e[1]);return n(l,t[2])-n(u,e[2])||n(l+t[2],o)-n(u+e[2],s);case 4:var c=t[0],f=t[1],h=t[2],d=t[3],p=e[0],g=e[1],v=e[2],m=e[3];return c+f+h+d-(p+g+v+m)||n(c,f,h,d)-n(p,g,v,m,p)||n(c+f,c+h,c+d,f+h,f+d,h+d)-n(p+g,p+v,p+m,g+v,g+m,v+m)||n(c+f+h,c+f+d,c+h+d,f+h+d)-n(p+g+v,p+g+m,p+v+m,g+v+m);default:for(var y=t.slice().sort(i),b=e.slice().sort(i),x=0;xt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}},{}],73:[function(t,e,r){"use strict";e.exports=function(t){var e=n(t),r=e.length;if(r<=2)return[];for(var i=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}(o,r)}};var n=t("incremental-convex-hull"),i=t("affine-hull")},{"affine-hull":13,"incremental-convex-hull":234}],75:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,u=(1+2*i)*l,c=i*l,f=s*(3-2*i),h=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=u*t[d]+c*e[d]+f*r[d]+h*n[d];return a}return u*t+c*e+f*r+h*n},e.exports.derivative=function(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n}},{}],76:[function(t,e,r){"use strict";var n=t("./lib/thunk.js");function i(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}e.exports=function(t){var e=new i;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var a=0;a0)throw new Error("cwise: pre() block may not reference array args");if(a0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(a),e.shimArgs.push("scalar"+a);else if("index"===o){if(e.indexArgs.push(a),a0)throw new Error("cwise: pre() block may not reference array index");if(a0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(a),ar.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,n(e)}},{"./lib/thunk.js":78}],77:[function(t,e,r){"use strict";var n=t("uniq");function i(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n0&&l.push("var "+u.join(",")),n=a-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function a(t,e,r){for(var n=t.body,i=[],a=[],o=0;o0&&y.push("shape=SS.slice(0)"),t.indexArgs.length>0){var b=new Array(r);for(l=0;l0&&m.push("var "+y.join(",")),l=0;l3&&m.push(a(t.pre,t,s));var M=a(t.body,t,s),A=function(t){for(var e=0,r=t[0].length;e0,u=[],c=0;c0;){"].join("")),u.push(["if(j",c,"<",s,"){"].join("")),u.push(["s",e[c],"=j",c].join("")),u.push(["j",c,"=0"].join("")),u.push(["}else{s",e[c],"=",s].join("")),u.push(["j",c,"-=",s,"}"].join("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(c=0;c3&&m.push(a(t.post,t,s)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+m.join("\n")+"\n----------");var T=[t.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",A,function(t){for(var e=new Array(t.length),r=!0,n=0;n0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}(s)].join("");return new Function(["function ",T,"(",v.join(","),"){",m.join("\n"),"} return ",T].join(""))()}},{uniq:330}],78:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],i=t.funcName+"_cwise_thunk";e.push(["return function ",i,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],c=0;c0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[c]))),u.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}for(t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),c=0;ce?1:t>=e?0:NaN}function d(t){return null===t?NaN:+t}function p(t){return!isNaN(t)}function g(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}t.ascending=h,t.descending=function(t,e){return et?1:e>=t?0:NaN},t.min=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++in&&(r=n)}else{for(;++i=n){r=n;break}for(;++in&&(r=n)}return r},t.max=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++ir&&(r=n)}else{for(;++i=n){r=n;break}for(;++ir&&(r=n)}return r},t.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return o/(l-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var v=g(h);function m(t){return t.length}t.bisectLeft=v.left,t.bisect=t.bisectRight=v.right,t.bisector=function(t){return g(1===t.length?function(e,r){return h(t(e),r)}:t)},t.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},t.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},t.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function b(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function x(){this._=Object.create(null)}t.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=function(t){var e=1;for(;t*e%1;)e*=10;return e}(y(r)),o=-1;if(t*=a,e*=a,(r*=a)<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=i.length)return r?r.call(n,a):e?a.sort(e):a;for(var l,u,c,f,h=-1,d=a.length,p=i[s++],g=new x;++h=i.length)return e;var n=[],o=a[r++];return e.forEach(function(e,i){n.push({key:e,values:t(i,r)})}),o?n.sort(function(t,e){return o(t.key,e.key)}):n}(o(t.map,e,0),0)},n.key=function(t){return i.push(t),n},n.sortKeys=function(t){return a[i.length-1]=t,n},n.sortValues=function(t){return e=t,n},n.rollup=function(t){return r=t,n},n},t.set=function(t){var e=new C;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},t.event=null,t.requote=function(t){return t.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,V={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function H(t){return V(t,W),t}var q=function(t,e){return e.querySelector(t)},G=function(t,e){return e.querySelectorAll(t)},X=function(t,e){var r=t.matches||t[R(t,"matchesSelector")];return(X=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(q=function(t,e){return Sizzle(t,e)[0]||null},G=Sizzle,X=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var W=t.selection.prototype=[];function Y(t){return"function"==typeof t?t:function(){return q(t,this)}}function Z(t){return"function"==typeof t?t:function(){return G(t,this)}}W.select=function(t){var e,r,n,i,a=[];t=Y(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),J.hasOwnProperty(r)?{space:J[r],local:t}:t}},W.attr=function(e,r){if(arguments.length<2){if("string"==typeof e){var n=this.node();return(e=t.ns.qualify(e)).local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(r in e)this.each(K(r,e[r]));return this}return this.each(K(e,r))},W.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=et(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},W.sort=function(t){t=function(t){arguments.length||(t=h);return function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.slice(0,o));var l=pt.get(e);function u(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=vt),o?r?function(){var t=s(r,n(arguments));u.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:u:r?N:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var i in this)if(r=i.match(n)){var a=this[i];this.removeEventListener(r[1],a,a.$),delete this[i]}}}t.selection.enter=ft,t.selection.enter.prototype=ht,ht.append=W.append,ht.empty=W.empty,ht.node=W.node,ht.call=W.call,ht.size=W.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s=n&&(n=e+1);!(o=s[n])&&++n0?1:t<0?-1:0}function Ot(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Rt(t){return t>1?0:t<-1?Tt:Math.acos(t)}function It(t){return t>1?St:t<-1?-St:Math.asin(t)}function Nt(t){return((t=Math.exp(t))+1/t)/2}function zt(t){return(t=Math.sin(t/2))*t}var Dt=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],u=e[2],c=s-i,f=l-a,h=c*c+f*f;if(h0&&(e=e.transition().duration(g)),e.call(w.event)}function E(){u&&u.domain(l.range().map(function(t){return(t-h.x)/h.k}).map(l.invert)),f&&f.domain(c.range().map(function(t){return(t-h.y)/h.k}).map(c.invert))}function S(t){v++||t({type:"zoomstart"})}function L(t){E(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function C(t){--v||(t({type:"zoomend"}),r=null)}function P(){var e=this,r=_.of(e,arguments),n=0,i=t.select(o(e)).on(y,function(){n=1,T(t.mouse(e),a),L(r)}).on(b,function(){i.on(y,null).on(b,null),s(n),C(r)}),a=M(t.mouse(e)),s=bt(e);fs.call(e),S(r)}function O(){var e,r=this,n=_.of(r,arguments),i={},a=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,u="touchend"+o,c=[],f=t.select(r),d=bt(r);function p(){var n=t.touches(r);return e=h.k,n.forEach(function(t){t.identifier in i&&(i[t.identifier]=M(t))}),n}function g(){var e=t.event.target;t.select(e).on(l,v).on(u,y),c.push(e);for(var n=t.event.changedTouches,o=0,f=n.length;o1){m=d[0];var b=d[1],x=m[0]-b[0],_=m[1]-b[1];a=x*x+_*_}}function v(){var o,l,u,c,f=t.touches(r);fs.call(r);for(var h=0,d=f.length;h360?t-=360:t<0&&(t+=360),t<60?n+(i-n)*t/60:t<180?i:t<240?n+(i-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(i=r<=.5?r*(1+e):r+e-r*e),new ae(a(t+120),a(t),a(t-120))}function Gt(e,r,n){return this instanceof Gt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Gt?new Gt(e.h,e.c,e.l):ee(e instanceof Yt?e.l:(e=he((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Gt(e,r,n)}Ht.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Vt(this.h,this.s,this.l/t)},Ht.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Vt(this.h,this.s,t*this.l)},Ht.rgb=function(){return qt(this.h,this.s,this.l)},t.hcl=Gt;var Xt=Gt.prototype=new Ut;function Wt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Yt(r,Math.cos(t*=Lt)*e,Math.sin(t)*e)}function Yt(t,e,r){return this instanceof Yt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Yt?new Yt(t.l,t.a,t.b):t instanceof Gt?Wt(t.h,t.c,t.l):he((t=ae(t)).r,t.g,t.b):new Yt(t,e,r)}Xt.brighter=function(t){return new Gt(this.h,this.c,Math.min(100,this.l+Zt*(arguments.length?t:1)))},Xt.darker=function(t){return new Gt(this.h,this.c,Math.max(0,this.l-Zt*(arguments.length?t:1)))},Xt.rgb=function(){return Wt(this.h,this.c,this.l).rgb()},t.lab=Yt;var Zt=18,Qt=.95047,Jt=1,Kt=1.08883,$t=Yt.prototype=new Ut;function te(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ae(ie(3.2404542*(i=re(i)*Qt)-1.5371385*(n=re(n)*Jt)-.4985314*(a=re(a)*Kt)),ie(-.969266*i+1.8760108*n+.041556*a),ie(.0556434*i-.2040259*n+1.0572252*a))}function ee(t,e,r){return t>0?new Gt(Math.atan2(r,e)*Ct,Math.sqrt(e*e+r*r),t):new Gt(NaN,NaN,t)}function re(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ne(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ie(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ae(t,e,r){return this instanceof ae?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ae?new ae(t.r,t.g,t.b):ce(""+t,ae,qt):new ae(t,e,r)}function oe(t){return new ae(t>>16,t>>8&255,255&t)}function se(t){return oe(t)+""}$t.brighter=function(t){return new Yt(Math.min(100,this.l+Zt*(arguments.length?t:1)),this.a,this.b)},$t.darker=function(t){return new Yt(Math.max(0,this.l-Zt*(arguments.length?t:1)),this.a,this.b)},$t.rgb=function(){return te(this.l,this.a,this.b)},t.rgb=ae;var le=ae.prototype=new Ut;function ue(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function ce(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(pe(i[0]),pe(i[1]),pe(i[2]))}return(a=ge.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function fe(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e0&&l<1?0:n),new Vt(n,i,l)}function he(t,e,r){var n=ne((.4124564*(t=de(t))+.3575761*(e=de(e))+.1804375*(r=de(r)))/Qt),i=ne((.2126729*t+.7151522*e+.072175*r)/Jt);return Yt(116*i-16,500*(n-i),200*(i-ne((.0193339*t+.119192*e+.9503041*r)/Kt)))}function de(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function pe(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}le.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,i=30;return e||r||n?(e&&e=200&&e<300||304===e){try{t=i.call(o,u)}catch(t){return void s.error.call(o,t)}s.load.call(o,t)}else s.error.call(o,u)}return!this.XDomainRequest||"withCredentials"in u||!/^(http(s)?:)?\/\//.test(e)||(u=new XDomainRequest),"onload"in u?u.onload=u.onerror=f:u.onreadystatechange=function(){u.readyState>3&&f()},u.onprogress=function(e){var r=t.event;t.event=e;try{s.progress.call(o,u)}finally{t.event=r}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?l[t]:(null==e?delete l[t]:l[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(r=null==t?null:t+"",o):r},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return i=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}}),o.send=function(t,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),u.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),u.setRequestHeader)for(var a in l)u.setRequestHeader(a,l[a]);return null!=r&&u.overrideMimeType&&u.overrideMimeType(r),null!=c&&(u.responseType=c),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),s.beforesend.call(o,u),u.send(null==n?null:n),o},o.abort=function(){return u.abort(),o},t.rebind(o,s,"on"),null==a?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(a))}ge.forEach(function(t,e){ge.set(t,oe(e))}),t.functor=ve,t.xhr=me(P),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function i(t,r,n){arguments.length<3&&(n=r,r=null);var i=ye(t,e,null==r?a:o(r),n);return i.row=function(t){return arguments.length?i.response(null==(r=t)?a:o(t)):r},i}function a(t){return i.parse(t.responseText)}function o(t){return function(e){return i.parse(e.responseText,t)}}function s(e){return e.map(l).join(t)}function l(t){return r.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return i.parse=function(t,e){var r;return i.parseRows(t,function(t,n){if(r)return r(t,n-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");r=e?function(t,r){return e(i(t),r)}:i})},i.parseRows=function(t,e){var r,i,a={},o={},s=[],l=t.length,u=0,c=0;function f(){if(u>=l)return o;if(i)return i=!1,a;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(we),we=setTimeout(Te,e)),_e=0):(_e=1,Me(Te))}function ke(){for(var t=Date.now(),e=be;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ee(){for(var t,e=be,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}});t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Se(e,r))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Le[8+n/3]};var Ce=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Pe=t.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(e,r){return(e=t.round(e,Se(e,r))).toFixed(Math.max(0,Math.min(20,Se(e*(1+1e-15),r))))}});function Oe(t){return t+""}var Re=t.time={},Ie=Date;function Ne(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Ne.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ze.setUTCDate.apply(this._,arguments)},setDay:function(){ze.setUTCDay.apply(this._,arguments)},setFullYear:function(){ze.setUTCFullYear.apply(this._,arguments)},setHours:function(){ze.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ze.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ze.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ze.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ze.setUTCSeconds.apply(this._,arguments)},setTime:function(){ze.setTime.apply(this._,arguments)}};var ze=Date.prototype;function De(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o68?1900:2e3),r+i[0].length):-1}function Qe(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Je(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Ke(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function $e(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ir(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,i=y(e)%60;return r+Ve(n,"0",2)+Ve(i,"0",2)}function ar(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function or(t){for(var e=t.length,r=-1;++r0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=i[o=(o+1)%i.length];return a.reverse().join(n)}:P;return function(e){var n=Ce.exec(e),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",u=n[4]||"",c=n[5],f=+n[6],h=n[7],d=n[8],p=n[9],g=1,v="",m="",y=!1,b=!0;switch(d&&(d=+d.substring(1)),(c||"0"===i&&"="===s)&&(c=i="0",s="="),p){case"n":h=!0,p="g";break;case"%":g=100,m="%",p="f";break;case"p":g=100,m="%",p="r";break;case"b":case"o":case"x":case"X":"#"===u&&(v="0"+p.toLowerCase());case"c":b=!1;case"d":y=!0,d=0;break;case"s":g=-1,p="r"}"$"===u&&(v=a[0],m=a[1]),"r"!=p||d||(p="g"),null!=d&&("g"==p?d=Math.max(1,Math.min(21,d)):"e"!=p&&"f"!=p||(d=Math.max(0,Math.min(20,d)))),p=Pe.get(p)||Oe;var x=c&&h;return function(e){var n=m;if(y&&e%1)return"";var a=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(g<0){var u=t.formatPrefix(e,d);e=u.scale(e),n=u.symbol+m}else e*=g;var _,w,M=(e=p(e,d)).lastIndexOf(".");if(M<0){var A=b?e.lastIndexOf("e"):-1;A<0?(_=e,w=""):(_=e.substring(0,A),w=e.substring(A))}else _=e.substring(0,M),w=r+e.substring(M+1);!c&&h&&(_=o(_,1/0));var T=v.length+_.length+w.length+(x?0:a.length),k=T"===s?k+a+e:"^"===s?k.substring(0,T>>=1)+a+e+k.substring(T):a+(x?e:k+e))+n}}}(e),timeFormat:function(e){var r=e.dateTime,n=e.date,i=e.time,a=e.periods,o=e.days,s=e.shortDays,l=e.months,u=e.shortMonths;function c(t){var e=t.length;function r(r){for(var n,i,a,o=[],s=-1,l=0;++s=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=w[o in je?e.charAt(s++):o])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}c.utc=function(t){var e=c(t);function r(t){try{var r=new(Ie=Ne);return r._=t,e(r)}finally{Ie=Date}}return r.parse=function(t){try{Ie=Ne;var r=e.parse(t);return r&&r._}finally{Ie=Date}},r.toString=e.toString,r},c.multi=c.utc.multi=or;var h=t.map(),d=He(o),p=qe(o),g=He(s),v=qe(s),m=He(l),y=qe(l),b=He(u),x=qe(u);a.forEach(function(t,e){h.set(t.toLowerCase(),e)});var _={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:c(r),d:function(t,e){return Ve(t.getDate(),e,2)},e:function(t,e){return Ve(t.getDate(),e,2)},H:function(t,e){return Ve(t.getHours(),e,2)},I:function(t,e){return Ve(t.getHours()%12||12,e,2)},j:function(t,e){return Ve(1+Re.dayOfYear(t),e,3)},L:function(t,e){return Ve(t.getMilliseconds(),e,3)},m:function(t,e){return Ve(t.getMonth()+1,e,2)},M:function(t,e){return Ve(t.getMinutes(),e,2)},p:function(t){return a[+(t.getHours()>=12)]},S:function(t,e){return Ve(t.getSeconds(),e,2)},U:function(t,e){return Ve(Re.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ve(Re.mondayOfYear(t),e,2)},x:c(n),X:c(i),y:function(t,e){return Ve(t.getFullYear()%100,e,2)},Y:function(t,e){return Ve(t.getFullYear()%1e4,e,4)},Z:ir,"%":function(){return"%"}},w={a:function(t,e,r){g.lastIndex=0;var n=g.exec(e.slice(r));return n?(t.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){d.lastIndex=0;var n=d.exec(e.slice(r));return n?(t.w=p.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){b.lastIndex=0;var n=b.exec(e.slice(r));return n?(t.m=x.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){m.lastIndex=0;var n=m.exec(e.slice(r));return n?(t.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,r){return f(t,_.c.toString(),e,r)},d:Ke,e:Ke,H:tr,I:tr,j:$e,L:nr,m:Je,M:er,p:function(t,e,r){var n=h.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:rr,U:Xe,w:Ge,W:We,x:function(t,e,r){return f(t,_.x.toString(),e,r)},X:function(t,e,r){return f(t,_.X.toString(),e,r)},y:Ze,Y:Ye,Z:Qe,"%":ar};return c}(e)}};var sr=t.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function lr(){}t.format=sr.numberFormat,t.geo={},lr.prototype={s:0,t:0,add:function(t){cr(t,this.t,ur),cr(ur.s,this.s,this),this.s?this.t+=ur.t:this.s=ur.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ur=new lr;function cr(t,e,r){var n=r.s=t+e,i=n-t,a=n-i;r.t=t-a+(e-i)}function fr(t,e){t&&dr.hasOwnProperty(t.type)&&dr[t.type](t,e)}t.geo.stream=function(t,e){t&&hr.hasOwnProperty(t.type)?hr[t.type](t,e):fr(t,e)};var hr={Feature:function(t,e){fr(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n=0?1:-1,s=o*a,l=Math.cos(e),u=Math.sin(e),c=i*u,f=n*l+c*Math.cos(s),h=c*o*Math.sin(s);Sr.add(Math.atan2(h,f)),r=t,n=l,i=u}Lr.point=function(o,s){Lr.point=a,r=(t=o)*Lt,n=Math.cos(s=(e=s)*Lt/2+Tt/4),i=Math.sin(s)},Lr.lineEnd=function(){a(t,e)}}function Pr(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function Or(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Rr(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Ir(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Nr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function zr(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Dr(t){return[Math.atan2(t[1],t[0]),It(t[2])]}function Fr(t,e){return y(t[0]-e[0])Mt?i=90:u<-Mt&&(r=-90),f[0]=e,f[1]=n}};function d(t,a){c.push(f=[e=t,n=t]),ai&&(i=a)}function p(t,o){var s=Pr([t*Lt,o*Lt]);if(l){var u=Rr(l,s),c=Rr([u[1],-u[0],0],u);zr(c),c=Dr(c);var f=t-a,h=f>0?1:-1,p=c[0]*Ct*h,g=y(f)>180;if(g^(h*ai&&(i=v);else if(g^(h*a<(p=(p+360)%360-180)&&pi&&(i=o);g?t_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>a?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else d(t,o);l=s,a=t}function g(){h.point=p}function v(){f[0]=e,f[1]=n,h.point=d,l=null}function m(t,e){if(l){var r=t-a;u+=y(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Lr.point(t,e),p(t,e)}function b(){Lr.lineStart()}function x(){m(o,s),Lr.lineEnd(),y(u)>Mt&&(e=-(n=180)),f[0]=e,f[1]=n,l=null}function _(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function M(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_(g[0],g[1])&&(g[1]=d[1]),_(d[0],g[1])>_(g[0],g[1])&&(g[0]=d[0])):s.push(g=d);for(var l,u,d,p=-1/0,g=(o=0,s[u=s.length-1]);o<=u;g=d,++o)d=s[o],(l=_(g[1],d[0]))>p&&(p=l,e=d[0],n=g[1])}return c=f=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,i]]}}(),t.geo.centroid=function(e){mr=yr=br=xr=_r=wr=Mr=Ar=Tr=kr=Er=0,t.geo.stream(e,jr);var r=Tr,n=kr,i=Er,a=r*r+n*n+i*i;return a=0;--s)i.point((f=c[s])[0],f[1]);else n(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,p=!p}while(!d.v);i.lineEnd()}}}function Yr(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,M=w*_,A=M>Tt,T=p*b;if(Sr.add(Math.atan2(T*w*Math.sin(M),g*x+T*Math.cos(M))),a+=A?_+w*kt:_,A^h>=r^m>=r){var k=Rr(Pr(f),Pr(t));zr(k);var E=Rr(i,k);zr(E);var S=(A^_>=0?-1:1)*It(E[2]);(n>S||n===S&&(k[0]||k[1]))&&(o+=A^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-Mt||a0){for(b||(o.polygonStart(),b=!0),o.lineStart();++a1&&2&e&&r.push(r.pop().concat(r.shift())),s.push(r.filter(Jr))}return c}}function Jr(t){return t.length>1}function Kr(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:N,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function $r(t,e){return((t=t.x)[0]<0?t[1]-St-Mt:St-t[1])-((e=e.x)[0]<0?e[1]-St-Mt:St-e[1])}var tn=Qr(Xr,function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Tt:-Tt,l=y(a-r);y(l-Tt)0?St:-St),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Tt&&(y(r-i)Mt?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}(r,n,a,o),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=a,n=o),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}},function(t,e,r,n){var i;if(null==t)i=r*St,n.point(-Tt,i),n.point(0,i),n.point(Tt,i),n.point(Tt,0),n.point(Tt,-i),n.point(0,-i),n.point(-Tt,-i),n.point(-Tt,0),n.point(-Tt,i);else if(y(t[0]-e[0])>Mt){var a=t[0]0)){if(a/=h,h<0){if(a0){if(a>f)return;a>c&&(c=a)}if(a=r-l,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a0)){if(a/=d,d<0){if(a0){if(a>f)return;a>c&&(c=a)}if(a=n-u,d||!(a<0)){if(a/=d,d<0){if(a>f)return;a>c&&(c=a)}else if(d>0){if(a0&&(i.a={x:l+c*h,y:u+c*d}),f<1&&(i.b={x:l+f*h,y:u+f*d}),i}}}}}}var rn=1e9;function nn(e,r,n,i){return function(l){var u,c,f,h,d,p,g,v,m,y,b,x=l,_=Kr(),w=en(e,r,n,i),M={point:k,lineStart:function(){M.point=E,c&&c.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){u&&(E(h,d),p&&m&&_.rejoin(),u.push(_.buffer()));M.point=k,m&&l.lineEnd()},polygonStart:function(){l=_,u=[],c=[],b=!0},polygonEnd:function(){l=x,u=t.merge(u);var r=function(t){for(var e=0,r=c.length,n=t[1],i=0;in&&Ot(u,a,t)>0&&++e:a[1]<=n&&Ot(u,a,t)<0&&--e,u=a;return 0!==e}([e,i]),n=b&&r,a=u.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),A(null,null,1,l),l.lineEnd()),a&&Wr(u,o,r,A,l),l.polygonEnd()),u=c=f=null}};function A(t,o,l,u){var c=0,f=0;if(null==t||(c=a(t,l))!==(f=a(o,l))||s(t,o)<0^l>0)do{u.point(0===c||3===c?e:n,c>1?i:r)}while((c=(c+l+4)%4)!==f);else u.point(o[0],o[1])}function T(t,a){return e<=t&&t<=n&&r<=a&&a<=i}function k(t,e){T(t,e)&&l.point(t,e)}function E(t,e){var r=T(t=Math.max(-rn,Math.min(rn,t)),e=Math.max(-rn,Math.min(rn,e)));if(c&&f.push([t,e]),y)h=t,d=e,p=r,y=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&m)l.point(t,e);else{var n={a:{x:g,y:v},b:{x:t,y:e}};w(n)?(m||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),b=!1):r&&(l.lineStart(),l.point(t,e),b=!1)}g=t,v=e,m=r}return M};function a(t,i){return y(t[0]-e)0?0:3:y(t[0]-n)0?2:1:y(t[1]-r)0?1:0:i>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}}function an(t){var e=0,r=Tt/3,n=Ln(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Tt/180,r=t[1]*Tt/180):[e/Tt*180,r/Tt*180]},i}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,i=1+r*(2*n-r),a=Math.sqrt(i)/n;function o(t,e){var r=Math.sqrt(i-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),a-r*Math.cos(t)]}return o.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/n,It((i-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,i,a,o={stream:function(t){return i&&(i.valid=!1),(i=a(t)).valid=!0,i},extent:function(s){return arguments.length?(a=nn(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),o):[[t,e],[r,n]]}};return o.extent([[0,0],[960,500]])},(t.geo.conicEqualArea=function(){return an(on)}).raw=on,t.geo.albers=function(){return t.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},t.geo.albersUsa=function(){var e,r,n,i,a=t.geo.albers(),o=t.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=t.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};function u(t){var a=t[0],o=t[1];return e=null,r(a,o),e||(n(a,o),e)||i(a,o),e}return u.invert=function(t){var e=a.scale(),r=a.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},u.stream=function(t){var e=a.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},u.precision=function(t){return arguments.length?(a.precision(t),o.precision(t),s.precision(t),u):a.precision()},u.scale=function(t){return arguments.length?(a.scale(t),o.scale(.35*t),s.scale(t),u.translate(a.translate())):a.scale()},u.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),c=+t[0],f=+t[1];return r=a.translate(t).clipExtent([[c-.455*e,f-.238*e],[c+.455*e,f+.238*e]]).stream(l).point,n=o.translate([c-.307*e,f+.201*e]).clipExtent([[c-.425*e+Mt,f+.12*e+Mt],[c-.214*e-Mt,f+.234*e-Mt]]).stream(l).point,i=s.translate([c-.205*e,f+.212*e]).clipExtent([[c-.214*e+Mt,f+.166*e+Mt],[c-.115*e-Mt,f+.234*e-Mt]]).stream(l).point,u},u.scale(1070)};var sn,ln,un,cn,fn,hn,dn={point:N,lineStart:N,lineEnd:N,polygonStart:function(){ln=0,dn.lineStart=pn},polygonEnd:function(){dn.lineStart=dn.lineEnd=dn.point=N,sn+=y(ln/2)}};function pn(){var t,e,r,n;function i(t,e){ln+=n*t-r*e,r=t,n=e}dn.point=function(a,o){dn.point=i,t=r=a,e=n=o},dn.lineEnd=function(){i(t,e)}}var gn={point:function(t,e){tfn&&(fn=t);ehn&&(hn=e)},lineStart:N,lineEnd:N,polygonStart:N,polygonEnd:N};function vn(){var t=mn(4.5),e=[],r={point:n,lineStart:function(){r.point=i},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=mn(e),r},result:function(){if(e.length){var t=e.join("");return e=[],t}}};function n(r,n){e.push("M",r,",",n,t)}function i(t,n){e.push("M",t,",",n),r.point=a}function a(t,r){e.push("L",t,",",r)}function o(){r.point=n}function s(){e.push("Z")}return r}function mn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var yn,bn={point:xn,lineStart:_n,lineEnd:wn,polygonStart:function(){bn.lineStart=Mn},polygonEnd:function(){bn.point=xn,bn.lineStart=_n,bn.lineEnd=wn}};function xn(t,e){br+=t,xr+=e,++_r}function _n(){var t,e;function r(r,n){var i=r-t,a=n-e,o=Math.sqrt(i*i+a*a);wr+=o*(t+r)/2,Mr+=o*(e+n)/2,Ar+=o,xn(t=r,e=n)}bn.point=function(n,i){bn.point=r,xn(t=n,e=i)}}function wn(){bn.point=xn}function Mn(){var t,e,r,n;function i(t,e){var i=t-r,a=e-n,o=Math.sqrt(i*i+a*a);wr+=o*(r+t)/2,Mr+=o*(n+e)/2,Ar+=o,Tr+=(o=n*t-r*e)*(r+t),kr+=o*(n+e),Er+=3*o,xn(r=t,n=e)}bn.point=function(a,o){bn.point=i,xn(t=r=a,e=n=o)},bn.lineEnd=function(){i(t,e)}}function An(t){var e=4.5,r={point:n,lineStart:function(){r.point=i},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=t,r},result:N};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,kt)}function i(e,n){t.moveTo(e,n),r.point=a}function a(e,r){t.lineTo(e,r)}function o(){r.point=n}function s(){t.closePath()}return r}function Tn(t){var e=.5,r=Math.cos(30*Lt),n=16;function i(e){return(n?function(e){var r,i,o,s,l,u,c,f,h,d,p,g,v={point:m,lineStart:y,lineEnd:x,polygonStart:function(){e.polygonStart(),v.lineStart=_},polygonEnd:function(){e.polygonEnd(),v.lineStart=y}};function m(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){f=NaN,v.point=b,e.lineStart()}function b(r,i){var o=Pr([r,i]),s=t(r,i);a(f,h,c,d,p,g,f=s[0],h=s[1],c=r,d=o[0],p=o[1],g=o[2],n,e),e.point(f,h)}function x(){v.point=m,e.lineEnd()}function _(){y(),v.point=w,v.lineEnd=M}function w(t,e){b(r=t,e),i=f,o=h,s=d,l=p,u=g,v.point=b}function M(){a(f,h,c,d,p,g,i,o,r,s,l,u,n,e),v.lineEnd=x,x()}return v}:function(e){return En(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})})(e)}function a(n,i,o,s,l,u,c,f,h,d,p,g,v,m){var b=c-n,x=f-i,_=b*b+x*x;if(_>4*e&&v--){var w=s+d,M=l+p,A=u+g,T=Math.sqrt(w*w+M*M+A*A),k=Math.asin(A/=T),E=y(y(A)-1)e||y((b*P+x*O)/_-.5)>.3||s*d+l*p+u*g0&&16,i):Math.sqrt(e)},i}function kn(t){this.stream=t}function En(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Sn(t){return Ln(function(){return t})()}function Ln(e){var r,n,i,a,o,s,l=Tn(function(t,e){return[(t=r(t,e))[0]*u+a,o-t[1]*u]}),u=150,c=480,f=250,h=0,d=0,p=0,g=0,v=0,m=tn,b=P,x=null,_=null;function w(t){return[(t=i(t[0]*Lt,t[1]*Lt))[0]*u+a,o-t[1]*u]}function M(t){return(t=i.invert((t[0]-a)/u,(o-t[1])/u))&&[t[0]*Ct,t[1]*Ct]}function A(){i=Gr(n=Rn(p,g,v),r);var t=r(h,d);return a=c-t[0]*u,o=f+t[1]*u,T()}function T(){return s&&(s.valid=!1,s=null),w}return w.stream=function(t){return s&&(s.valid=!1),(s=Cn(m(n,l(b(t))))).valid=!0,s},w.clipAngle=function(t){return arguments.length?(m=null==t?(x=t,tn):function(t){var e=Math.cos(t),r=e>0,n=y(e)>Mt;return Qr(i,function(t){var e,s,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=i(f,h),v=r?g?0:o(f,h):g?o(f+(f<0?Tt:-Tt),h):0;if(!e&&(u=l=g)&&t.lineStart(),g!==l&&(d=a(e,p),(Fr(e,d)||Fr(p,d))&&(p[0]+=Mt,p[1]+=Mt,g=i(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1]),t.lineEnd()),e=d;else if(n&&e&&r^g){var m;v&s||!(m=a(p,e,!0))||(c=0,r?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||e&&Fr(e,p)||t.point(p[0],p[1]),e=p,l=g,s=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(u&&l)<<1}}},Dn(t,6*Lt),r?[0,-t]:[-Tt,t-Tt]);function i(t,r){return Math.cos(t)*Math.cos(r)>e}function a(t,r,n){var i=[1,0,0],a=Rr(Pr(t),Pr(r)),o=Or(a,a),s=a[0],l=o-s*s;if(!l)return!n&&t;var u=e*o/l,c=-e*s/l,f=Rr(i,a),h=Nr(i,u);Ir(h,Nr(a,c));var d=f,p=Or(h,d),g=Or(d,d),v=p*p-g*(Or(h,h)-1);if(!(v<0)){var m=Math.sqrt(v),b=Nr(d,(-p-m)/g);if(Ir(b,h),b=Dr(b),!n)return b;var x,_=t[0],w=r[0],M=t[1],A=r[1];w<_&&(x=_,_=w,w=x);var T=w-_,k=y(T-Tt)0^b[1]<(y(b[0]-_)Tt^(_<=b[0]&&b[0]<=w)){var E=Nr(d,(-p+m)/g);return Ir(E,h),[b,Dr(E)]}}}function o(e,n){var i=r?t:Tt-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}((x=+t)*Lt),T()):x},w.clipExtent=function(t){return arguments.length?(_=t,b=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):P,T()):_},w.scale=function(t){return arguments.length?(u=+t,A()):u},w.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],A()):[c,f]},w.center=function(t){return arguments.length?(h=t[0]%360*Lt,d=t[1]%360*Lt,A()):[h*Ct,d*Ct]},w.rotate=function(t){return arguments.length?(p=t[0]%360*Lt,g=t[1]%360*Lt,v=t.length>2?t[2]%360*Lt:0,A()):[p*Ct,g*Ct,v*Ct]},t.rebind(w,l,"precision"),function(){return r=e.apply(this,arguments),w.invert=r.invert&&M,A()}}function Cn(t){return En(t,function(e,r){t.point(e*Lt,r*Lt)})}function Pn(t,e){return[t,e]}function On(t,e){return[t>Tt?t-kt:t<-Tt?t+kt:t,e]}function Rn(t,e,r){return t?e||r?Gr(Nn(t),zn(e,r)):Nn(t):e||r?zn(e,r):On}function In(t){return function(e,r){return[(e+=t)>Tt?e-kt:e<-Tt?e+kt:e,r]}}function Nn(t){var e=In(t);return e.invert=In(-t),e}function zn(t,e){var r=Math.cos(t),n=Math.sin(t),i=Math.cos(e),a=Math.sin(e);function o(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*r+s*n;return[Math.atan2(l*i-c*a,s*r-u*n),It(c*i+l*a)]}return o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*i-l*a;return[Math.atan2(l*i+u*a,s*r+c*n),It(c*r-s*n)]},o}function Dn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Fn(r,i),a=Fn(r,a),(o>0?ia)&&(i+=o*kt)):(i=t+o*kt,a=t-.5*l);for(var u,c=i;o>0?c>a:c2?t[2]*Lt:0),e.invert=function(e){return(e=t.invert(e[0]*Lt,e[1]*Lt))[0]*=Ct,e[1]*=Ct,e},e},On.invert=Pn,t.geo.circle=function(){var t,e,r=[0,0],n=6;function i(){var t="function"==typeof r?r.apply(this,arguments):r,n=Rn(-t[0]*Lt,-t[1]*Lt,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Ct,t[1]*=Ct}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=Dn((t=+r)*Lt,n*Lt),i):t},i.precision=function(r){return arguments.length?(e=Dn(t*Lt,(n=+r)*Lt),i):n},i.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Lt,i=t[1]*Lt,a=e[1]*Lt,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},t.geo.graticule=function(){var e,r,n,i,a,o,s,l,u,c,f,h,d=10,p=d,g=90,v=360,m=2.5;function b(){return{type:"MultiLineString",coordinates:x()}}function x(){return t.range(Math.ceil(i/g)*g,n,g).map(f).concat(t.range(Math.ceil(l/v)*v,s,v).map(h)).concat(t.range(Math.ceil(r/d)*d,e,d).filter(function(t){return y(t%g)>Mt}).map(u)).concat(t.range(Math.ceil(o/p)*p,a,p).filter(function(t){return y(t%v)>Mt}).map(c))}return b.lines=function(){return x().map(function(t){return{type:"LineString",coordinates:t}})},b.outline=function(){return{type:"Polygon",coordinates:[f(i).concat(h(s).slice(1),f(n).reverse().slice(1),h(l).reverse().slice(1))]}},b.extent=function(t){return arguments.length?b.majorExtent(t).minorExtent(t):b.minorExtent()},b.majorExtent=function(t){return arguments.length?(i=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],i>n&&(t=i,i=n,n=t),l>s&&(t=l,l=s,s=t),b.precision(m)):[[i,l],[n,s]]},b.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),o>a&&(t=o,o=a,a=t),b.precision(m)):[[r,o],[e,a]]},b.step=function(t){return arguments.length?b.majorStep(t).minorStep(t):b.minorStep()},b.majorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],b):[g,v]},b.minorStep=function(t){return arguments.length?(d=+t[0],p=+t[1],b):[d,p]},b.precision=function(t){return arguments.length?(m=+t,u=jn(o,a,90),c=Bn(r,e,m),f=jn(l,s,90),h=Bn(i,n,m),b):m},b.majorExtent([[-180,-90+Mt],[180,90-Mt]]).minorExtent([[-180,-80-Mt],[180,80+Mt]])},t.geo.greatArc=function(){var e,r,n=Un,i=Vn;function a(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}return a.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},a.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,a):n},a.target=function(t){return arguments.length?(i=t,r="function"==typeof t?null:t,a):i},a.precision=function(){return arguments.length?a:0},a},t.geo.interpolate=function(t,e){return r=t[0]*Lt,n=t[1]*Lt,i=e[0]*Lt,a=e[1]*Lt,o=Math.cos(n),s=Math.sin(n),l=Math.cos(a),u=Math.sin(a),c=o*Math.cos(r),f=o*Math.sin(r),h=l*Math.cos(i),d=l*Math.sin(i),p=2*Math.asin(Math.sqrt(zt(a-n)+o*l*zt(i-r))),g=1/Math.sin(p),(v=p?function(t){var e=Math.sin(t*=p)*g,r=Math.sin(p-t)*g,n=r*c+e*h,i=r*f+e*d,a=r*s+e*u;return[Math.atan2(i,n)*Ct,Math.atan2(a,Math.sqrt(n*n+i*i))*Ct]}:function(){return[r*Ct,n*Ct]}).distance=p,v;var r,n,i,a,o,s,l,u,c,f,h,d,p,g,v},t.geo.length=function(e){return yn=0,t.geo.stream(e,Hn),yn};var Hn={sphere:N,point:N,lineStart:function(){var t,e,r;function n(n,i){var a=Math.sin(i*=Lt),o=Math.cos(i),s=y((n*=Lt)-t),l=Math.cos(s);yn+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*a-e*o*l)*s),e*a+r*o*l),t=n,e=a,r=o}Hn.point=function(i,a){t=i*Lt,e=Math.sin(a*=Lt),r=Math.cos(a),Hn.point=n},Hn.lineEnd=function(){Hn.point=Hn.lineEnd=N}},lineEnd:N,polygonStart:N,polygonEnd:N};function qn(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),a=t(n*i);return[a*i*Math.sin(e),a*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),a=Math.sin(i),o=Math.cos(i);return[Math.atan2(t*a,n*o),Math.asin(n&&r*a/n)]},r}var Gn=qn(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(t.geo.azimuthalEqualArea=function(){return Sn(Gn)}).raw=Gn;var Xn=qn(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},P);function Wn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(Tt/4+t/2)},i=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),a=r*Math.pow(n(t),i)/i;if(!i)return Qn;function o(t,e){a>0?e<-St+Mt&&(e=-St+Mt):e>St-Mt&&(e=St-Mt);var r=a/Math.pow(n(e),i);return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}return o.invert=function(t,e){var r=a-e,n=Pt(i)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/i,2*Math.atan(Math.pow(a/n,1/i))-St]},o}function Yn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),i=r/n+t;if(y(n)1&&Ot(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ii(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Sn($n)}).raw=$n,ti.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-St]},(t.geo.transverseMercator=function(){var t=Jn(ti),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):[(t=r())[0],t[1],t[2]-90]},r([0,0,90])}).raw=ti,t.geom={},t.geom.hull=function(t){var e=ei,r=ri;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=ve(e),a=ve(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)d.push(t[s[u[n]][2]]);for(n=+f;nMt)s=s.L;else{if(!((i=a-wi(s,o))>Mt)){n>-Mt?(e=s.P,r=s):i>-Mt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=mi(t);if(fi.insert(e,l),e||r){if(e===r)return Ei(e),r=mi(e.site),fi.insert(l,r),l.edge=r.edge=Ci(e.site,l.site),ki(e),void ki(r);if(r){Ei(e),Ei(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,v=p.y-f,m=2*(h*v-d*g),y=h*h+d*d,b=g*g+v*v,x={x:(v*y-d*b)/m+c,y:(h*b-g*y)/m+f};Pi(r.edge,u,p,x),l.edge=Ci(u,t,null,x),r.edge=Ci(t,p,null,x),ki(e),ki(r)}else l.edge=Ci(e.site,l.site)}}function _i(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;var s=(r=o.site).x,l=r.y,u=l-e;if(!u)return s;var c=s-n,f=1/a-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-a/2)))/f+n:(n+s)/2}function wi(t,e){var r=t.N;if(r)return _i(r,e);var n=t.site;return n.y===e?n.x:1/0}function Mi(t){this.site=t,this.edges=[]}function Ai(t,e){return e.angle-t.angle}function Ti(){Ii(this),this.x=this.y=this.arc=this.site=this.cy=null}function ki(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,a=r.site;if(n!==a){var o=i.x,s=i.y,l=n.x-o,u=n.y-s,c=a.x-o,f=2*(l*(v=a.y-s)-u*c);if(!(f>=-At)){var h=l*l+u*u,d=c*c+v*v,p=(v*h-u*d)/f,g=(l*d-c*h)/f,v=g+s,m=gi.pop()||new Ti;m.arc=t,m.site=i,m.x=p+o,m.y=v+Math.sqrt(p*p+g*g),m.cy=v,t.circle=m;for(var y=null,b=di._;b;)if(m.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(a){if(a.y=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.xMt||y(i-r)>Mt)&&(s.splice(o,0,new Oi((m=a.site,b=c,x=y(n-f)Mt?{x:f,y:y(e-f)Mt?{x:y(r-p)Mt?{x:h,y:y(e-h)Mt?{x:y(r-d)=r&&u.x<=i&&u.y>=n&&u.y<=o?[[r,o],[i,o],[i,n],[r,n]]:[]).point=t[s]}),e}function s(t){return t.map(function(t,e){return{x:Math.round(n(t,e)/Mt)*Mt,y:Math.round(i(t,e)/Mt)*Mt,i:e}})}return o.links=function(t){return Fi(s(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},o.triangles=function(t){var e=[];return Fi(s(t)).cells.forEach(function(r,n){for(var i,a,o,s,l=r.site,u=r.edges.sort(Ai),c=-1,f=u.length,h=u[f-1].edge,d=h.l===l?h.r:h.l;++ca&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:Gi(r,n)})),a=Yi.lastIndex;return ag&&(g=l.x),l.y>v&&(v=l.y),u.push(l.x),c.push(l.y);else for(f=0;fg&&(g=x),_>v&&(v=_),u.push(x),c.push(_)}var w=g-d,M=v-p;function A(t,e,r,n,i,a,o,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,u=t.y;if(null!=l)if(y(l-r)+y(u-n)<.01)T(t,e,r,n,i,a,o,s);else{var c=t.point;t.x=t.y=t.point=null,T(t,c,l,u,i,a,o,s),T(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else T(t,e,r,n,i,a,o,s)}function T(t,e,r,n,i,a,o,s){var l=.5*(i+o),u=.5*(a+s),c=r>=l,f=n>=u,h=f<<1|c;t.leaf=!1,c?i=l:o=l,f?a=u:s=u,A(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){A(k,t,+m(t,++f),+b(t,f),d,p,g,v)}}),e,r,n,i,a,o,s)}w>M?v=p+w:g=d+M;var k={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){A(k,t,+m(t,++f),+b(t,f),d,p,g,v)}};if(k.visit=function(t){!function t(e,r,n,i,a,o){if(!e(r,n,i,a,o)){var s=.5*(n+a),l=.5*(i+o),u=r.nodes;u[0]&&t(e,u[0],n,i,s,l),u[1]&&t(e,u[1],s,i,a,l),u[2]&&t(e,u[2],n,l,s,o),u[3]&&t(e,u[3],s,l,a,o)}}(t,k,d,p,g,v)},k.find=function(t){return function(t,e,r,n,i,a,o){var s,l=1/0;return function t(u,c,f,h,d){if(!(c>a||f>o||h=_)<<1|e>=x,M=w+4;w=0&&!(n=t.interpolators[i](e,r)););return n}function Qi(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function aa(t){return 1-Math.cos(t*St)}function oa(t){return Math.pow(2,10*(t-1))}function sa(t){return 1-Math.sqrt(1-t*t)}function la(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function ua(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function ca(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=ha(i),s=fa(i,a),l=ha(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,n):t,a=n>=0?t.slice(n+1):"in";return i=Ki.get(i)||Ji,a=$i.get(a)||P,e=a(i.apply(null,r.call(arguments,1))),function(t){return t<=0?0:t>=1?1:e(t)}},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,i=e.c,a=e.l,o=r.h-n,s=r.c-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.c:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Wt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,i=e.s,a=e.l,o=r.h-n,s=r.s-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.s:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return qt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,i=e.a,a=e.b,o=r.l-n,s=r.a-i,l=r.b-a;return function(t){return te(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=ua,t.transform=function(e){var r=i.createElementNS(t.ns.prefix.svg,"g");return(t.transform=function(t){if(null!=t){r.setAttribute("transform",t);var e=r.transform.baseVal.consolidate()}return new ca(e?e.matrix:da)})(e)},ca.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var da={a:1,b:0,c:0,d:1,e:0,f:0};function pa(t){return t.length?t.pop()+",":""}function ga(e,r){var n=[],i=[];return e=t.transform(e),r=t.transform(r),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push("translate(",null,",",null,")");n.push({i:i-4,x:Gi(t[0],e[0])},{i:i-2,x:Gi(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,i),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(pa(r)+"rotate(",null,")")-2,x:Gi(t,e)})):e&&r.push(pa(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(pa(r)+"skewX(",null,")")-2,x:Gi(t,e)}):e&&r.push(pa(r)+"skewX("+e+")")}(e.skew,r.skew,n,i),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(pa(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Gi(t[0],e[0])},{i:i-2,x:Gi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(pa(r)+"scale("+e+")")}(e.scale,r.scale,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r0?n=t:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:n=0})):t>0&&(l.start({type:"start",alpha:n=t}),e=Ae(s.tick)),s):n},s.start=function(){var t,e,r,n=m.length,l=y.length,c=u[0],p=u[1];for(t=0;t=0;)r.push(i[n])}function La(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++o=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;r&&(a.value=0),a.children=u}else r&&(a.value=+r.call(n,a,a.depth)||0),delete a.children;return La(i,function(e){var n,i;t&&(n=e.children)&&n.sort(t),r&&(i=e.parent)&&(i.value+=e.value)}),s}return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Sa(t,function(t){t.children&&(t.value=0)}),La(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},t.layout.partition=function(){var e=t.layout.hierarchy(),r=[1,1];function n(t,n){var i=e.call(this,t,n);return function t(e,r,n,i){var a=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,a&&(o=a.length)){var o,s,l,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;ri&&(n=r,i=e);return n}function Ha(t){return t.reduce(qa,0)}function qa(t,e){return t+e[1]}function Ga(t,e){return Xa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Xa(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function Wa(e){return[t.min(e),t.max(e)]}function Ya(t,e){return t.value-e.value}function Za(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Qa(t,e){t._pack_next=e,e._pack_prev=t}function Ja(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Ka(t){if((e=t.children)&&(l=e.length)){var e,r,n,i,a,o,s,l,u=1/0,c=-1/0,f=1/0,h=-1/0;if(e.forEach($a),(r=e[0]).x=-r.r,r.y=0,b(r),l>1&&((n=e[1]).x=n.r,n.y=0,b(n),l>2))for(eo(r,n,i=e[2]),b(i),Za(r,i),r._pack_prev=i,Za(i,n),n=r._pack_next,a=3;a0)for(o=-1;++o=f[0]&&l<=f[1]&&((s=u[t.bisect(h,l,1,p)-1]).y+=g,s.push(a[o]));return u}return a.value=function(t){return arguments.length?(r=t,a):r},a.range=function(t){return arguments.length?(n=ve(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Xa(e,t)}:ve(t),a):i},a.frequency=function(t){return arguments.length?(e=!!t,a):e},a},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(Ya),n=0,i=[1,1];function a(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,La(s,function(t){t.r=+c(t.value)}),La(s,Ka),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;La(s,function(t){t.r+=f}),La(s,Ka),La(s,function(t){t.r-=f})}return function t(e,r,n,i){var a=e.children;e.x=r+=i*e.x;e.y=n+=i*e.y;e.r*=i;if(a)for(var o=-1,s=a.length;++od.x&&(d=t),t.depth>p.depth&&(p=t)});var g=r(h,d)/2-h.x,v=n[0]/(d.x+r(d,h)/2+g),m=n[1]/(p.depth||1);Sa(c,function(t){t.x=(t.x+g)*v,t.y=t.depth*m})}return u}function o(t){var e=t.children,n=t.parent.children,i=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,i=t.children,a=i.length;for(;--a>=0;)(e=i[a]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;i?(t.z=i.z+r(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+r(t._,i._));t.parent.A=function(t,e,n){if(e){for(var i,a=t,o=t,s=e,l=a.parent.children[0],u=a.m,c=o.m,f=s.m,h=l.m;s=io(s),a=no(a),s&&a;)l=no(l),(o=io(o)).a=t,(i=s.z+f-a.z-u+r(s._,a._))>0&&(ao(oo(s,t,n),t,i),u+=i,c+=i),f+=s.m,u+=a.m,h+=l.m,c+=o.m;s&&!io(o)&&(o.t=s,o.m+=f-c),a&&!no(l)&&(l.t=a,l.m+=u-h,n=t)}return n}(t,i,t.parent.A||n[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=n[0],t.y=t.depth*n[1]}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t)?l:null,a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null==(n=t)?null:l,a):i?n:null},Ea(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=ro,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),u=l[0],c=0;La(u,function(e){var n=e.children;n&&n.length?(e.x=function(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}(n),e.y=function(e){return 1+t.max(e,function(t){return t.y})}(n)):(e.x=s?c+=r(e,s):0,e.y=0,s=e)});var f=function t(e){var r=e.children;return r&&r.length?t(r[0]):e}(u),h=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(u),d=f.x-r(f,h)/2,p=h.x+r(h,f)/2;return La(u,i?function(t){t.x=(t.x-u.x)*n[0],t.y=(u.y-t.y)*n[1]}:function(t){t.x=(t.x-d)/(p-d)*n[0],t.y=(1-(u.y?t.y/u.y:1))*n[1]}),l}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t),a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null!=(n=t),a):i?n:null},Ea(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=so,s=!1,l="squarify",u=.5*(1+Math.sqrt(5));function c(t,e){for(var r,n,i=-1,a=t.length;++i0;)s.push(r=u[i-1]),s.area+=r.area,"squarify"!==l||(n=d(s,g))<=h?(u.pop(),h=n):(s.area-=s.pop().area,p(s,g,a,!1),g=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(p(s,g,a,!0),s.length=s.area=0),e.forEach(f)}}function h(t){var e=t.children;if(e&&e.length){var r,n=o(t),i=e.slice(),a=[];for(c(i,n.dx*n.dy/t.value),a.area=0;r=i.pop();)a.push(r),a.area+=r.area,null!=r.z&&(p(a,r.z?n.dx:n.dy,n,!i.length),a.length=a.area=0);e.forEach(h)}}function d(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return e*=e,(n*=n)?Math.max(e*i*u/n,n/(e*a*u)):1/0}function p(t,e,r,i){var a,o=-1,s=t.length,l=r.x,u=r.y,c=e?n(t.area/e):0;if(e==r.dx){for((i||c>r.dy)&&(c=r.dy);++or.dx)&&(c=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=t.random.normal.apply(t,arguments);return function(){return Math.exp(e())}},bates:function(e){var r=t.random.irwinHall(e);return function(){return r()/e}},irwinHall:function(t){return function(){for(var e=0,r=0;r2?vo:fo,s=i?ma:va;return a=t(e,r,s,n),o=t(r,e,s,Zi),l}function l(t){return a(t)}l.invert=function(t){return o(t)};l.domain=function(t){return arguments.length?(e=t.map(Number),s()):e};l.range=function(t){return arguments.length?(r=t,s()):r};l.rangeRound=function(t){return l.range(t).interpolate(ua)};l.clamp=function(t){return arguments.length?(i=t,s()):i};l.interpolate=function(t){return arguments.length?(n=t,s()):n};l.ticks=function(t){return xo(e,t)};l.tickFormat=function(t,r){return _o(e,t,r)};l.nice=function(t){return yo(e,t),s()};l.copy=function(){return t(e,r,n,i)};return s()}([0,1],[0,1],Zi,!1)};var wo={s:1,g:1,p:1,r:1,e:1};function Mo(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,i,a){function o(t){return(i?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return i?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return r(o(t))}l.invert=function(t){return s(r.invert(t))};l.domain=function(t){return arguments.length?(i=t[0]>=0,r.domain((a=t.map(Number)).map(o)),l):a};l.base=function(t){return arguments.length?(n=+t,r.domain(a.map(o)),l):n};l.nice=function(){var t=ho(a.map(o),i?Math:To);return r.domain(t),a=t.map(s),l};l.ticks=function(){var t=uo(a),e=[],r=t[0],l=t[1],u=Math.floor(o(r)),c=Math.ceil(o(l)),f=n%1?2:n;if(isFinite(c-u)){if(i){for(;u0;h--)e.push(s(u)*h);for(u=0;e[u]l;c--);e=e.slice(u,c)}return e};l.tickFormat=function(e,r){if(!arguments.length)return Ao;arguments.length<2?r=Ao:"function"!=typeof r&&(r=t.format(r));var i=Math.max(1,n*e/l.ticks().length);return function(t){var e=t/s(Math.round(o(t)));return e*n0?i[t-1]:r[0],tf?0:1;if(u=Et)return l(u,d)+(s?l(s,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,M,A,T,k=0,E=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Oo?Math.sqrt(s*s+u*u):+n.apply(this,arguments),d||(E*=-1),u&&(E=It(v/u*Math.sin(m))),s&&(k=It(v/s*Math.sin(m)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var L=Math.abs(f-c-2*E)<=Tt?0:1;if(E&&Fo(y,b,x,_)===d^L){var C=(c+f)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(s){w=s*Math.cos(f-k),M=s*Math.sin(f-k),A=s*Math.cos(c+k),T=s*Math.sin(c+k);var P=Math.abs(c-f+2*k)<=Tt?0:1;if(k&&Fo(w,M,A,T)===1-d^P){var O=(c+f)/2;w=s*Math.cos(O),M=s*Math.sin(O),A=T=null}}else w=M=0;if(h>Mt&&(p=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function jo(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,v=h-c,m=d-f,y=v*v+m*m,b=r-n,x=c*d-h*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*m-v*_)/y,M=(-x*v-m*_)/y,A=(x*m+v*_)/y,T=(-x*v+m*_)/y,k=w-p,E=M-g,S=A-p,L=T-g;return k*k+E*E>S*S+L*L&&(w=A,M=T),[[w-l,M-u],[w*r/b,M*r/b]]}function Bo(t){var e=ei,r=ri,n=Xr,i=Vo,a=i.key,o=.7;function s(a){var s,l=[],u=[],c=-1,f=a.length,h=ve(e),d=ve(r);function p(){l.push("M",i(t(u),o))}for(;++c1&&i.push("H",n[0]);return i.join("")},"step-before":qo,"step-after":Go,basis:Yo,"basis-open":function(t){if(t.length<4)return Vo(t);var e,r=[],n=-1,i=t.length,a=[0],o=[0];for(;++n<3;)e=t[n],a.push(e[0]),o.push(e[1]);r.push(Zo(Ko,a)+","+Zo(Ko,o)),--n;for(;++n9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));s=-1;for(;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}(t))}});function Vo(t){return t.length>1?t.join("L"):t+"Z"}function Ho(t){return t.join("L")+"Z"}function qo(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;uTt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=ve(t),a):r},a.source=function(e){return arguments.length?(t=ve(e),a):t},a.target=function(t){return arguments.length?(e=ve(t),a):e},a.startAngle=function(t){return arguments.length?(n=ve(t),a):n},a.endAngle=function(t){return arguments.length?(i=ve(t),a):i},a},t.svg.diagonal=function(){var t=Un,e=Vn,r=is;function n(n,i){var a=t.call(this,n,i),o=e.call(this,n,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return"M"+(l=l.map(r))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}return n.source=function(e){return arguments.length?(t=ve(e),n):t},n.target=function(t){return arguments.length?(e=ve(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},t.svg.diagonal.radial=function(){var e=t.svg.diagonal(),r=is,n=e.projection;return e.projection=function(t){return arguments.length?n(function(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-St;return[r*Math.cos(n),r*Math.sin(n)]}}(r=t)):r},e},t.svg.symbol=function(){var t=os,e=as;function r(r,n){return(ls.get(t.call(this,r,n))||ss)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=ve(e),r):t},r.size=function(t){return arguments.length?(e=ve(t),r):e},r};var ls=t.map({circle:ss,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*cs)),r=e*cs;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/us),r=e*us/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/us),r=e*us/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ls.keys();var us=Math.sqrt(3),cs=Math.tan(30*Lt);W.transition=function(t){for(var e,r,n=ps||++ms,i=xs(t),a=[],o=gs||{time:Date.now(),ease:ia,delay:0,duration:250},s=-1,l=this.length;++s0;)u[--h].call(t,o);if(a>=1)return f.event&&f.event.end.call(t,t.__data__,e),--c.count?delete c[n]:delete t[r],1}f||(a=i.time,o=Ae(function(t){var e=f.delay;if(o.t=e+a,e<=t)return h(t-e);o.c=h},0,a),f=c[n]={tween:new x,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++c.count)}vs.call=W.call,vs.empty=W.empty,vs.node=W.node,vs.size=W.size,t.transition=function(e,r){return e&&e.transition?ps?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=vs,vs.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=Y(t);for(var s=-1,l=this.length;++srect,.s>rect").attr("width",s[1]-s[0])}function g(t){t.select(".extent").attr("y",l[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",l[1]-l[0])}function v(){var f,v,m=this,y=t.select(t.event.target),b=n.of(m,arguments),x=t.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&i,M=!/^(e|w)$/.test(_)&&a,A=y.classed("extent"),T=bt(m),k=t.mouse(m),E=t.select(o(m)).on("keydown.brush",function(){32==t.event.keyCode&&(A||(f=null,k[0]-=s[1],k[1]-=l[1],A=2),F())}).on("keyup.brush",function(){32==t.event.keyCode&&2==A&&(k[0]+=s[1],k[1]+=l[1],A=0,F())});if(t.event.changedTouches?E.on("touchmove.brush",C).on("touchend.brush",O):E.on("mousemove.brush",C).on("mouseup.brush",O),x.interrupt().selectAll("*").interrupt(),A)k[0]=s[0]-k[0],k[1]=l[0]-k[1];else if(_){var S=+/w$/.test(_),L=+/^n/.test(_);v=[s[1-S]-k[0],l[1-L]-k[1]],k[0]=s[S],k[1]=l[L]}else t.event.altKey&&(f=k.slice());function C(){var e=t.mouse(m),r=!1;v&&(e[0]+=v[0],e[1]+=v[1]),A||(t.event.altKey?(f||(f=[(s[0]+s[1])/2,(l[0]+l[1])/2]),k[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Rs(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Rs(+e+1);return e}}:t))},i.ticks=function(t,e){var r=uo(i.domain()),n=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Rs(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Os(e.copy(),r,n)},mo(i,e)}function Rs(t){return new Date(t)}Ss.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Ps:Cs,Ps.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Ps.toString=Cs.toString,Re.second=De(function(t){return new Ie(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),Re.seconds=Re.second.range,Re.seconds.utc=Re.second.utc.range,Re.minute=De(function(t){return new Ie(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),Re.minutes=Re.minute.range,Re.minutes.utc=Re.minute.utc.range,Re.hour=De(function(t){var e=t.getTimezoneOffset()/60;return new Ie(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),Re.hours=Re.hour.range,Re.hours.utc=Re.hour.utc.range,Re.month=De(function(t){return(t=Re.day(t)).setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),Re.months=Re.month.range,Re.months.utc=Re.month.utc.range;var Is=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Ns=[[Re.second,1],[Re.second,5],[Re.second,15],[Re.second,30],[Re.minute,1],[Re.minute,5],[Re.minute,15],[Re.minute,30],[Re.hour,1],[Re.hour,3],[Re.hour,6],[Re.hour,12],[Re.day,1],[Re.day,2],[Re.week,1],[Re.month,1],[Re.month,3],[Re.year,1]],zs=Ss.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Xr]]),Ds={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Rs)},floor:P,ceil:P};Ns.year=Re.year,Re.scale=function(){return Os(t.scale.linear(),Ns,zs)};var Fs=Ns.map(function(t){return[t[0].utc,t[1]]}),js=Ls.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Xr]]);function Bs(t){return JSON.parse(t.responseText)}function Us(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}Fs.year=Re.year.utc,Re.scale.utc=function(){return Os(t.scale.linear(),Fs,js)},t.text=me(function(t){return t.responseText}),t.json=function(t,e){return ye(t,"application/json",Bs,e)},t.html=function(t,e){return ye(t,"text/html",Us,e)},t.xml=me(function(t){return t.responseXML}),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],81:[function(t,e,r){e.exports=function(){for(var t=0;t=2)return!1;t[r]=n}return!0}):_.filter(function(t){for(var e=0;e<=s;++e){var r=m[t[e]];if(r<0)return!1;t[e]=r}return!0});if(1&s)for(var c=0;c<_.length;++c){var x=_[c],h=x[0];x[0]=x[1],x[1]=h}return _}},{"incremental-convex-hull":234,uniq:330}],83:[function(t,e,r){(function(t){var r=!1;if("undefined"!=typeof Float64Array){var n=new Float64Array(1),i=new Uint32Array(n.buffer);if(n[0]=1,r=!0,1072693248===i[1]){e.exports=function(t){return n[0]=t,[i[0],i[1]]},e.exports.pack=function(t,e){return i[0]=t,i[1]=e,n[0]},e.exports.lo=function(t){return n[0]=t,i[0]},e.exports.hi=function(t){return n[0]=t,i[1]}}else if(1072693248===i[0]){e.exports=function(t){return n[0]=t,[i[1],i[0]]},e.exports.pack=function(t,e){return i[1]=t,i[0]=e,n[0]},e.exports.lo=function(t){return n[0]=t,i[1]},e.exports.hi=function(t){return n[0]=t,i[0]}}else r=!1}if(!r){var a=new t(8);e.exports=function(t){return a.writeDoubleLE(t,0,!0),[a.readUInt32LE(0,!0),a.readUInt32LE(4,!0)]},e.exports.pack=function(t,e){return a.writeUInt32LE(t,0,!0),a.writeUInt32LE(e,4,!0),a.readDoubleLE(0,!0)},e.exports.lo=function(t){return a.writeDoubleLE(t,0,!0),a.readUInt32LE(0,!0)},e.exports.hi=function(t){return a.writeDoubleLE(t,0,!0),a.readUInt32LE(4,!0)}}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:47}],84:[function(t,e,r){e.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},{}],85:[function(t,e,r){"use strict";e.exports=function(t,e){switch(void 0===e&&(e=0),typeof t){case"number":if(t>0)return function(t,e){var r,n;for(r=new Array(t),n=0;n0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){if(!i(e))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var r,n,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(o=(r=this._events[t]).length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(i(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],89:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}},{}],90:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&function(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],91:[function(t,e,r){"use strict";e.exports=function(t,e,r){switch(arguments.length){case 0:return new o([0],[0],0);case 1:if("number"==typeof t){var n=l(t);return new o(n,n,0)}return new o(t,l(t.length),0);case 2:if("number"==typeof e){var n=l(t.length);return new o(t,n,+e)}r=0;case 3:if(t.length!==e.length)throw new Error("state and velocity lengths must match");return new o(t,e,r)}};var n=t("cubic-hermite"),i=t("binary-search-bounds");function a(t,e,r){return Math.min(e,Math.max(t,r))}function o(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1){h=l.length-1;var p=t-e[r-1];for(d=0;d=r-1)for(var c=s.length-1,f=(e[r-1],0);f=0;--r)if(t[--e])return!1;return!0},s.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--f)n.push(a(l[f-1],u[f-1],arguments[f])),i.push(0)}},s.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-6?1/s:0;this._time.push(t);for(var h=r;h>0;--h){var d=a(u[h-1],c[h-1],arguments[h]);n.push(d),i.push((d-n[o++])*f)}}},s.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(a(o[l-1],s[l-1],arguments[l])),n.push(0)}},s.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var n=this._state,i=this._velocity,o=n.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,f=c>1e-6?1/c:0;this._time.push(t);for(var h=r;h>0;--h){var d=arguments[h];n.push(a(l[h-1],u[h-1],n[o++]+d)),i.push(d*f)}}},s.idle=function(t){var e=this.lastT();if(!(t=0;--f)n.push(a(l[f],u[f],n[o]+c*i[o])),i.push(0),o+=1}}},{"binary-search-bounds":35,"cubic-hermite":75}],92:[function(t,e,r){"use strict";e.exports=function(t){return new u(t||p,null)};var n=0,i=1;function a(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function o(t){return new a(t._color,t.key,t.value,t.left,t.right,t._count)}function s(t,e){return new a(t,e.key,e.value,e.left,e.right,e._count)}function l(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function u(t,e){this._compare=t,this.root=e}var c=u.prototype;function f(t,e){this.tree=t,this._stack=e}Object.defineProperty(c,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(c,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(c,"length",{get:function(){return this.root?this.root._count:0}}),c.insert=function(t,e){for(var r=this._compare,o=this.root,c=[],f=[];o;){var h=r(t,o.key);c.push(o),f.push(h),o=h<=0?o.left:o.right}c.push(new a(n,t,e,null,null,1));for(var d=c.length-2;d>=0;--d){o=c[d];f[d]<=0?c[d]=new a(o._color,o.key,o.value,c[d+1],o.right,o._count+1):c[d]=new a(o._color,o.key,o.value,o.left,c[d+1],o._count+1)}for(d=c.length-1;d>1;--d){var p=c[d-1];o=c[d];if(p._color===i||o._color===i)break;var g=c[d-2];if(g.left===p)if(p.left===o){if(!(v=g.right)||v._color!==n){if(g._color=n,g.left=p.right,p._color=i,p.right=g,c[d-2]=p,c[d-1]=o,l(g),l(p),d>=3)(m=c[d-3]).left===g?m.left=p:m.right=p;break}p._color=i,g.right=s(i,v),g._color=n,d-=1}else{if(!(v=g.right)||v._color!==n){if(p.right=o.left,g._color=n,g.left=o.right,o._color=i,o.left=p,o.right=g,c[d-2]=o,c[d-1]=p,l(g),l(p),l(o),d>=3)(m=c[d-3]).left===g?m.left=o:m.right=o;break}p._color=i,g.right=s(i,v),g._color=n,d-=1}else if(p.right===o){if(!(v=g.left)||v._color!==n){if(g._color=n,g.right=p.left,p._color=i,p.left=g,c[d-2]=p,c[d-1]=o,l(g),l(p),d>=3)(m=c[d-3]).right===g?m.right=p:m.left=p;break}p._color=i,g.left=s(i,v),g._color=n,d-=1}else{var v;if(!(v=g.left)||v._color!==n){var m;if(p.left=o.right,g._color=n,g.right=o.left,o._color=i,o.right=p,o.left=g,c[d-2]=o,c[d-1]=p,l(g),l(p),l(o),d>=3)(m=c[d-3]).right===g?m.right=o:m.left=o;break}p._color=i,g.left=s(i,v),g._color=n,d-=1}}return c[0]._color=i,new u(r,c[0])},c.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return function t(e,r){var n;if(r.left&&(n=t(e,r.left)))return n;return(n=e(r.key,r.value))||(r.right?t(e,r.right):void 0)}(t,this.root);case 2:return function t(e,r,n,i){if(r(e,i.key)<=0){var a;if(i.left&&(a=t(e,r,n,i.left)))return a;if(a=n(i.key,i.value))return a}if(i.right)return t(e,r,n,i.right)}(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return function t(e,r,n,i,a){var o,s=n(e,a.key),l=n(r,a.key);if(s<=0){if(a.left&&(o=t(e,r,n,i,a.left)))return o;if(l>0&&(o=i(a.key,a.value)))return o}if(l>0&&a.right)return t(e,r,n,i,a.right)}(e,r,this._compare,t,this.root)}},Object.defineProperty(c,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(c,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),c.at=function(t){if(t<0)return new f(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new f(this,[])},c.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<=0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new f(this,n)},c.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new f(this,n)},c.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new f(this,n)},c.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>=0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new f(this,n)},c.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new f(this,n);r=i<=0?r.left:r.right}return new f(this,[])},c.remove=function(t){var e=this.find(t);return e?e.remove():this},c.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var h=f.prototype;function d(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function p(t,e){return te?1:0}Object.defineProperty(h,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(h,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),h.clone=function(){return new f(this.tree,this._stack.slice())},h.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new a(r._color,r.key,r.value,r.left,r.right,r._count);for(var c=t.length-2;c>=0;--c){(r=t[c]).left===t[c+1]?e[c]=new a(r._color,r.key,r.value,e[c+1],r.right,r._count):e[c]=new a(r._color,r.key,r.value,r.left,e[c+1],r._count)}if((r=e[e.length-1]).left&&r.right){var f=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var h=e[f-1];e.push(new a(r._color,h.key,h.value,r.left,r.right,r._count)),e[f-1].key=r.key,e[f-1].value=r.value;for(c=e.length-2;c>=f;--c)r=e[c],e[c]=new a(r._color,r.key,r.value,r.left,e[c+1],r._count);e[f-1].left=e[f]}if((r=e[e.length-1])._color===n){var p=e[e.length-2];p.left===r?p.left=null:p.right===r&&(p.right=null),e.pop();for(c=0;c=0;--c){if(e=t[c],0===c)return void(e._color=i);if((r=t[c-1]).left===e){if((a=r.right).right&&a.right._color===n)return u=(a=r.right=o(a)).right=o(a.right),r.right=a.left,a.left=r,a.right=u,a._color=r._color,e._color=i,r._color=i,u._color=i,l(r),l(a),c>1&&((f=t[c-2]).left===r?f.left=a:f.right=a),void(t[c-1]=a);if(a.left&&a.left._color===n)return u=(a=r.right=o(a)).left=o(a.left),r.right=u.left,a.left=u.right,u.left=r,u.right=a,u._color=r._color,r._color=i,a._color=i,e._color=i,l(r),l(a),l(u),c>1&&((f=t[c-2]).left===r?f.left=u:f.right=u),void(t[c-1]=u);if(a._color===i){if(r._color===n)return r._color=i,void(r.right=s(n,a));r.right=s(n,a);continue}a=o(a),r.right=a.left,a.left=r,a._color=r._color,r._color=n,l(r),l(a),c>1&&((f=t[c-2]).left===r?f.left=a:f.right=a),t[c-1]=a,t[c]=r,c+11&&((f=t[c-2]).right===r?f.right=a:f.left=a),void(t[c-1]=a);if(a.right&&a.right._color===n)return u=(a=r.left=o(a)).right=o(a.right),r.left=u.right,a.right=u.left,u.right=r,u.left=a,u._color=r._color,r._color=i,a._color=i,e._color=i,l(r),l(a),l(u),c>1&&((f=t[c-2]).right===r?f.right=u:f.left=u),void(t[c-1]=u);if(a._color===i){if(r._color===n)return r._color=i,void(r.left=s(n,a));r.left=s(n,a);continue}var f;a=o(a),r.left=a.right,a.right=r,a._color=r._color,r._color=n,l(r),l(a),c>1&&((f=t[c-2]).right===r?f.right=a:f.left=a),t[c-1]=a,t[c]=r,c+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(h,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(h,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),h.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(h,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),h.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),n=e[e.length-1];r[r.length-1]=new a(n._color,n.key,t,n.left,n.right,n._count);for(var i=e.length-2;i>=0;--i)(n=e[i]).left===e[i+1]?r[i]=new a(n._color,n.key,n.value,r[i+1],n.right,n._count):r[i]=new a(n._color,n.key,n.value,n.left,r[i+1],n._count);return new u(this.tree._compare,r[0])},h.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(h,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],93:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=607/128,a=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function o(t){if(t<0)return Number("0/0");for(var e=a[0],r=a.length-1;r>0;--r)e+=a[r]/(t+r);var n=t+i+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(o(e));e-=1;for(var r=n[0],i=1;i<9;i++)r+=n[i]/(e+i);var a=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(a,e+.5)*Math.exp(-a)*r},e.exports.log=o},{}],94:[function(t,e,r){e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width);"number"==typeof e.height&&(r.height=e.height);var n,i=e;try{var a=[t];0===t.indexOf("webgl")&&a.push("experimental-"+t);for(var o=0;o0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}var g=[0,0,0],v={model:l,view:l,projection:l};f.isOpaque=function(){return!0},f.isTransparent=function(){return!1},f.drawTransparent=function(t){};var m=[0,0,0],y=[0,0,0],b=[0,0,0];f.draw=function(t){t=t||v;for(var e=this.gl,r=t.model||l,n=t.view||l,i=t.projection||l,a=this.bounds,s=o(r,n,i,a),c=s.cubeEdges,f=s.axis,h=n[12],x=n[13],_=n[14],w=n[15],M=this.pixelRatio*(i[3]*h+i[7]*x+i[11]*_+i[15]*w)/e.drawingBufferHeight,A=0;A<3;++A)this.lastCubeProps.cubeEdges[A]=c[A],this.lastCubeProps.axis[A]=f[A];var T=d;for(A=0;A<3;++A)p(d[A],A,this.bounds,c,f);e=this.gl;var k=g;for(A=0;A<3;++A)this.backgroundEnable[A]?k[A]=f[A]:k[A]=0;this._background.draw(r,n,i,a,k,this.backgroundColor),this._lines.bind(r,n,i,this);for(A=0;A<3;++A){var E=[0,0,0];f[A]>0?E[A]=a[1][A]:E[A]=a[0][A];for(var S=0;S<2;++S){var L=(A+1+S)%3,C=(A+1+(1^S))%3;this.gridEnable[L]&&this._lines.drawGrid(L,C,this.bounds,E,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(S=0;S<2;++S){L=(A+1+S)%3,C=(A+1+(1^S))%3;this.zeroEnable[C]&&a[0][C]<=0&&a[1][C]>=0&&this._lines.drawZero(L,C,this.bounds,E,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(A=0;A<3;++A){this.lineEnable[A]&&this._lines.drawAxisLine(A,this.bounds,T[A].primalOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio),this.lineMirror[A]&&this._lines.drawAxisLine(A,this.bounds,T[A].mirrorOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio);var P=u(m,T[A].primalMinor),O=u(y,T[A].mirrorMinor),R=this.lineTickLength;for(S=0;S<3;++S){var I=M/r[5*S];P[S]*=R[S]*I,O[S]*=R[S]*I}this.lineTickEnable[A]&&this._lines.drawAxisTicks(A,T[A].primalOffset,P,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio),this.lineTickMirror[A]&&this._lines.drawAxisTicks(A,T[A].mirrorOffset,O,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio)}this._lines.unbind(),this._text.bind(r,n,i,this.pixelRatio);for(A=0;A<3;++A){var N=T[A].primalMinor,z=u(b,T[A].primalOffset);for(S=0;S<3;++S)this.lineTickEnable[A]&&(z[S]+=M*N[S]*Math.max(this.lineTickLength[S],0)/r[5*S]);if(this.tickEnable[A]){for(S=0;S<3;++S)z[S]+=M*N[S]*this.tickPad[S]/r[5*S];this._text.drawTicks(A,this.tickSize[A],this.tickAngle[A],z,this.tickColor[A])}if(this.labelEnable[A]){for(S=0;S<3;++S)z[S]+=M*N[S]*this.labelPad[S]/r[5*S];z[A]+=.5*(a[0][A]+a[1][A]),this._text.drawLabel(A,this.labelSize[A],this.labelAngle[A],z,this.labelColor[A])}}this._text.unbind()},f.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":96,"./lib/cube.js":97,"./lib/lines.js":98,"./lib/text.js":100,"./lib/ticks.js":101}],96:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=[],s=0,l=0;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,f=[0,0,0],h=[0,0,0],d=-1;d<=1;d+=2){r.push(s,s+2,s+1,s+1,s+2,s+3),f[l]=d,h[l]=d;for(var p=-1;p<=1;p+=2){f[u]=p;for(var g=-1;g<=1;g+=2)f[c]=g,e.push(f[0],f[1],f[2],h[0],h[1],h[2]),s+=1}var v=u;u=c,c=v}var m=n(t,new Float32Array(e)),y=n(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=i(t,[{buffer:m,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:m,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=a(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new o(t,m,b,x)};var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders").bg;function o(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}var s=o.prototype;s.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),this.vao.unbind(),l.disable(l.POLYGON_OFFSET_FILL)}},s.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":99,"gl-buffer":103,"gl-vao":161}],97:[function(t,e,r){"use strict";e.exports=function(t,e,r,a){i(s,e,t),i(s,r,s);for(var d=0,y=0;y<2;++y){c[2]=a[y][2];for(var b=0;b<2;++b){c[1]=a[b][1];for(var x=0;x<2;++x)c[0]=a[x][0],h(l[d],c,s),d+=1}}for(var _=-1,y=0;y<8;++y){for(var w=l[y][3],M=0;M<3;++M)u[y][M]=l[y][M]/w;w<0&&(_<0?_=y:u[y][2]E&&(_|=1<E&&(_|=1<u[y][1]&&(N=y));for(var z=-1,y=0;y<3;++y){var D=N^1<u[F][0]&&(F=D)}}var j=g;j[0]=j[1]=j[2]=0,j[n.log2(z^N)]=N&z,j[n.log2(N^F)]=N&F;var B=7^F;B===_||B===I?(B=7^z,j[n.log2(F^B)]=B&F):j[n.log2(z^B)]=B&z;for(var U=v,V=_,A=0;A<3;++A)U[A]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}"]),c=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}"]);r.bg=function(t){return i(t,u,c,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":146,glslify:230}],100:[function(t,e,r){(function(r){"use strict";e.exports=function(t,e,r,a,s,l){var c=n(t),f=i(t,[{buffer:c,size:3}]),h=o(t);h.attributes.position.location=0;var d=new u(t,h,c,f);return d.update(e,r,a,s,l),d};var n=t("gl-buffer"),i=t("gl-vao"),a=t("vectorize-text"),o=t("./shaders").text,s=window||r.global||{},l=s.__TEXT_CACHE||{};s.__TEXT_CACHE={};function u(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}var c=u.prototype,f=[0,0];c.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,f[0]=this.gl.drawingBufferWidth,f[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=f},c.unbind=function(){this.vao.unbind()},c.update=function(t,e,r,n,i){this.gl;var o=[];function s(t,e,r,n){var i=l[r];i||(i=l[r]={});var s=i[e];s||(s=i[e]=function(t,e){try{return a(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var u=(n||12)/12,c=s.positions,f=s.cells,h=0,d=f.length;h=0;--g){var v=c[p[g]];o.push(u*v[0],-u*v[1],t)}}for(var u=[0,0,0],c=[0,0,0],f=[0,0,0],h=[0,0,0],d=0;d<3;++d){f[d]=o.length/3|0,s(.5*(t[0][d]+t[1][d]),e[d],r),h[d]=(o.length/3|0)-f[d],u[d]=o.length/3|0;for(var p=0;p=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u|=0);var c=""+l;if(o<0&&(c="-"+c),i){for(var f=""+u;f.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r},r.equal=function(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;nr)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function c(t,e){for(var r=n.malloc(t.length,e),i=t.length,a=0;a=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=u(this.gl,this.type,this.length,this.usage,t.data,e):this.length=u(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=n.malloc(t.size,r),l=a(s,t.shape);i.assign(l,t),this.length=u(this.gl,this.type,this.length,this.usage,e<0?s:s.subarray(0,t.size),e),n.free(s)}}else if(Array.isArray(t)){var f;f=this.type===this.gl.ELEMENT_ARRAY_BUFFER?c(t,"uint16"):c(t,"float32"),this.length=u(this.gl,this.type,this.length,this.usage,e<0?f:f.subarray(0,t.length),e),n.free(f)}else if("object"==typeof t&&"number"==typeof t.length)this.length=u(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");(t|=0)<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=function(t,e,r,n){if(r=r||t.ARRAY_BUFFER,n=n||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(n!==t.DYNAMIC_DRAW&&n!==t.STATIC_DRAW&&n!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var i=t.createBuffer(),a=new s(t,r,i,0,n);return a.update(e),a}},{ndarray:265,"ndarray-ops":259,"typedarray-pool":328}],104:[function(t,e,r){"use strict";var n=t("gl-vec3"),i=(t("gl-vec4"),function(t,e){for(var r=0;r=e)return r-1;return r}),a=n.create(),o=n.create(),s=function(t,e,r){return tr?r:t},l=function(t,e,r,l){var u=t[0],c=t[1],f=t[2],h=r[0].length,d=r[1].length,p=r[2].length,g=i(r[0],u),v=i(r[1],c),m=i(r[2],f),y=g+1,b=v+1,x=m+1;if(l&&(g=s(g,0,h-1),y=s(y,0,h-1),v=s(v,0,d-1),b=s(b,0,d-1),m=s(m,0,p-1),x=s(x,0,p-1)),g<0||v<0||m<0||y>=h||b>=d||x>=p)return n.create();var _=(u-r[0][g])/(r[0][y]-r[0][g]),w=(c-r[1][v])/(r[1][b]-r[1][v]),M=(f-r[2][m])/(r[2][x]-r[2][m]);(_<0||_>1||isNaN(_))&&(_=0),(w<0||w>1||isNaN(w))&&(w=0),(M<0||M>1||isNaN(M))&&(M=0);var A=m*h*d,T=x*h*d,k=v*h,E=b*h,S=g,L=y,C=e[k+A+S],P=e[k+A+L],O=e[E+A+S],R=e[E+A+L],I=e[k+T+S],N=e[k+T+L],z=e[E+T+S],D=e[E+T+L],F=n.create();return n.lerp(F,C,P,_),n.lerp(a,O,R,_),n.lerp(F,F,a,w),n.lerp(a,I,N,_),n.lerp(o,z,D,_),n.lerp(a,a,o,w),n.lerp(F,F,a,M),F};e.exports=function(t,e){var r;r=t.positions?t.positions:function(t){for(var e=t[0],r=t[1],n=t[2],i=[],a=0;as&&(s=n.length(x)),b&&(y=Math.min(y,2*n.distance(g,_)/(n.length(v)+n.length(x)))),g=_,v=x,m.push(x)}var w=[u,f,d],M=[c,h,p];e&&(e[0]=w,e[1]=M),0===s&&(s=1);var A=1/s;isFinite(y)&&!isNaN(y)||(y=1),o.vectorScale=y;var T=function(t,e,r){var i=n.create();return void 0!==t&&n.set(i,t,e,r),i}(0,1,0),k=t.coneSize||.5;t.absoluteConeSize&&(k=t.absoluteConeSize*A),o.coneScale=k;b=0;for(var E=0;b1.0001)return null;v+=g[c]}if(Math.abs(v-1)>.001)return null;return[f,function(t,e){for(var r=[0,0,0],n=0;n=1},b.isTransparent=function(){return this.opacity<1},b.pickSlots=1,b.setPickBase=function(t){this.pickId=t},b.highlight=function(t){if(t&&this.contourEnable){for(var e=h(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=d.mallocFloat32(6*a),s=0,l=0;l0&&((f=this.triShader).bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind());this.edgeCount>0&&this.lineWidth>0&&((f=this.lineShader).bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind());this.pointCount>0&&((f=this.pointShader).bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind());this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0&&((f=this.contourShader).bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind())},b.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||m,n=t.view||m,i=t.projection||m,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s,l={model:r,view:n,projection:i,clipBounds:a,vectorScale:this.vectorScale,coneScale:this.coneScale,coneOffset:this.coneOffset,pickId:this.pickId/255};((s=this.pickShader).bind(),s.uniforms=l,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0)&&((s=this.pointPickShader).bind(),s.uniforms=l,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind())},b.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions[r[1]].slice(0,3);return{index:Math.floor(r[1]/48),position:n,dataCoordinate:n}},b.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.pickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleVectors.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleNormals.dispose(),this.triangleIds.dispose(),this.edgeVAO.dispose(),this.edgePositions.dispose(),this.edgeColors.dispose(),this.edgeUVs.dispose(),this.edgeIds.dispose(),this.pointVAO.dispose(),this.pointPositions.dispose(),this.pointColors.dispose(),this.pointUVs.dispose(),this.pointSizes.dispose(),this.pointIds.dispose(),this.contourVAO.dispose(),this.contourPositions.dispose()},e.exports=function(t,e){1===arguments.length&&(t=(e=t).gl);var r=e.triShader||function(t){var e=n(t,g.vertex,g.fragment,null,g.attributes);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.vector.location=5,e}(t),s=x(t),l=o(t,c(new Uint8Array([255,255,255,255]),[1,1,4]));l.generateMipmap(),l.minFilter=t.LINEAR_MIPMAP_LINEAR,l.magFilter=t.LINEAR;var u=i(t),f=i(t),h=i(t),d=i(t),p=i(t),v=i(t),m=a(t,[{buffer:u,type:t.FLOAT,size:4},{buffer:v,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:h,type:t.FLOAT,size:4},{buffer:d,type:t.FLOAT,size:2},{buffer:p,type:t.FLOAT,size:3},{buffer:f,type:t.FLOAT,size:3}]),b=i(t),_=i(t),w=i(t),M=i(t),A=a(t,[{buffer:b,type:t.FLOAT,size:3},{buffer:M,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:_,type:t.FLOAT,size:4},{buffer:w,type:t.FLOAT,size:2}]),T=i(t),k=i(t),E=i(t),S=i(t),L=i(t),C=a(t,[{buffer:T,type:t.FLOAT,size:3},{buffer:L,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:k,type:t.FLOAT,size:4},{buffer:E,type:t.FLOAT,size:2},{buffer:S,type:t.FLOAT,size:1}]),P=i(t),O=new y(t,l,r,null,null,s,null,null,u,f,v,h,d,p,m,b,M,_,w,A,T,L,k,E,S,C,P,a(t,[{buffer:P,type:t.FLOAT,size:3}]));return O.update(e),O}},{"./closest-point":105,"./shaders":107,colormap:67,"gl-buffer":103,"gl-mat4/invert":124,"gl-mat4/multiply":126,"gl-shader":146,"gl-texture2d":157,"gl-vao":161,ndarray:265,normals:267,"simplicial-complex-contour":309,"typedarray-pool":328}],107:[function(t,e,r){var n=t("glslify"),i=n(["precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float index, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n index = mod(index, segmentCount * 6.0);\n\n float segment = floor(index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex == 3.0) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n // angle = 2pi * ((segment + ((segmentIndex == 1.0 || segmentIndex == 5.0) ? 1.0 : 0.0)) / segmentCount)\n float nextAngle = float(segmentIndex == 1.0 || segmentIndex == 5.0);\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex <= 2.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\nuniform float vectorScale;\nuniform float coneScale;\n\nuniform float coneOffset;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal), 0.0);\n normal = normalize(normal * inverse(mat3(model)));\n\n // vec4 m_position = model * vec4(conePosition, 1.0);\n vec4 t_position = view * conePosition;\n gl_Position = projection * t_position;\n f_color = color; //vec4(position.w, color.r, 0, 0);\n f_normal = normal;\n f_data = conePosition.xyz;\n f_eyeDirection = eyePosition - conePosition.xyz;\n f_lightDirection = lightPosition - conePosition.xyz;\n f_uv = uv;\n}\n"]),a=n(["precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\nfloat cookTorranceSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n //if(any(lessThan(f_data, clipBounds[0])) || \n // any(greaterThan(f_data, clipBounds[1]))) {\n // discard;\n //}\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}"]),o=n(["precision mediump float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float index, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n index = mod(index, segmentCount * 6.0);\n\n float segment = floor(index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex == 3.0) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n // angle = 2pi * ((segment + ((segmentIndex == 1.0 || segmentIndex == 5.0) ? 1.0 : 0.0)) / segmentCount)\n float nextAngle = float(segmentIndex == 1.0 || segmentIndex == 5.0);\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex <= 2.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nuniform float vectorScale;\nuniform float coneScale;\nuniform float coneOffset;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal), 0.0);\n gl_Position = projection * view * conePosition;\n f_id = id;\n f_position = position.xyz;\n}\n"]),s=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec4"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec3"}]},r.pickShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec3"}]}},{glslify:230}],108:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34000:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],109:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":108}],110:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e),o=i(e,[{buffer:r,type:e.FLOAT,size:3,offset:0,stride:40},{buffer:r,type:e.FLOAT,size:4,offset:12,stride:40},{buffer:r,type:e.FLOAT,size:3,offset:28,stride:40}]),l=a(e);l.attributes.position.location=0,l.attributes.color.location=1,l.attributes.offset.location=2;var u=new s(e,r,o,l);return u.update(t),u};var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders/index"),o=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function s(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}var l=s.prototype;function u(t,e){for(var r=0;r<3;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}l.isOpaque=function(){return this.opacity>=1},l.isTransparent=function(){return this.opacity<1},l.drawTransparent=l.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||o,i=r.projection=t.projection||o;r.model=t.model||o,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],s=n[13],l=n[14],u=n[15],c=this.pixelRatio*(i[3]*a+i[7]*s+i[11]*l+i[15]*u)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f)e.lineWidth(this.lineWidth[f]),r.capSize=this.capSize[f]*c,this.lineCount[f]&&e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var c=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=[0,0,0];a[(n+e)%3]=i,r.push(a)}t[e]=r}return t}();function f(t,e,r,n){for(var i=c[n],a=0;a0)(g=c.slice())[s]+=d[1][s],i.push(c[0],c[1],c[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),u(this.bounds,g),o+=2+f(i,g,p,s)}}this.lineCount[s]=o-this.lineOffset[s]}this.buffer.update(i)}},l.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":111,"gl-buffer":103,"gl-vao":161}],111:[function(t,e,r){"use strict";var n=t("glslify"),i=t("gl-shader"),a=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}"]),o=n(["precision mediump float;\n#define GLSLIFY 1\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(fragPosition, clipBounds[0])) || any(greaterThan(fragPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = opacity * fragColor;\n}"]);e.exports=function(t){return i(t,a,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},{"gl-shader":146,glslify:230}],112:[function(t,e,r){"use strict";var n=t("gl-texture2d");e.exports=function(t,e,r,n){i||(i=t.FRAMEBUFFER_UNSUPPORTED,a=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,o=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,s=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var u=t.getExtension("WEBGL_draw_buffers");!l&&u&&function(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);l=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;ac||r<0||r>c)throw new Error("gl-fbo: Parameters are too large for FBO");var f=1;if("color"in(n=n||{})){if((f=Math.max(0|n.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(f>1){if(!u)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(f>t.getParameter(u.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+f+" draw buffers")}}var h=t.UNSIGNED_BYTE,d=t.getExtension("OES_texture_float");if(n.float&&f>0){if(!d)throw new Error("gl-fbo: Context does not support floating point textures");h=t.FLOAT}else n.preferFloat&&f>0&&d&&(h=t.FLOAT);var g=!0;"depth"in n&&(g=!!n.depth);var v=!1;"stencil"in n&&(v=!!n.stencil);return new p(t,e,r,h,f,g,v,u)};var i,a,o,s,l=null;function u(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}function c(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function f(t){switch(t){case i:throw new Error("gl-fbo: Framebuffer unsupported");case a:throw new Error("gl-fbo: Framebuffer incomplete attachment");case o:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case s:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function h(t,e,r,i,a,o){if(!i)return null;var s=n(t,e,r,a,i);return s.magFilter=t.NEAREST,s.minFilter=t.NEAREST,s.mipSamples=1,s.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,s.handle,0),s}function d(t,e,r,n,i){var a=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,a),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,a),a}function p(t,e,r,n,i,a,o,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(i);for(var p=0;p1&&s.drawBuffersWEBGL(l[o]);var y=r.getExtension("WEBGL_depth_texture");y?p?t.depth=h(r,i,a,y.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g&&(t.depth=h(r,i,a,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):g&&p?t._depth_rb=d(r,i,a,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g?t._depth_rb=d(r,i,a,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):p&&(t._depth_rb=d(r,i,a,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){for(t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null),m=0;mi||r<0||r>i)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var a=u(n),o=0;o FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1540259130(pixelArcLength).xyz);\n}"]),l=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];r.createShader=function(t){return i(t,a,o,null,l)},r.createPickShader=function(t){return i(t,a,s,null,l)}},{"gl-shader":146,glslify:230}],115:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=c(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var o=f(e);o.attributes.position.location=0,o.attributes.nextPosition.location=1,o.attributes.arcLength.location=2,o.attributes.lineWidth.location=3,o.attributes.color.location=4;for(var s=n(e),u=i(e,[{buffer:s,size:3,offset:0,stride:48},{buffer:s,size:3,offset:12,stride:48},{buffer:s,size:1,offset:24,stride:48},{buffer:s,size:1,offset:28,stride:48},{buffer:s,size:4,offset:32,stride:48}]),h=l(new Array(1024),[256,1,4]),d=0;d<1024;++d)h.data[d]=255;var p=a(e,h);p.wrap=e.REPEAT;var g=new v(e,r,o,s,u,p);return g.update(t),g};var n=t("gl-buffer"),i=t("gl-vao"),a=t("gl-texture2d"),o=t("glsl-read-float"),s=t("binary-search-bounds"),l=t("ndarray"),u=t("./lib/shaders"),c=u.createShader,f=u.createPickShader,h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function d(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function p(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function g(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function v(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}var m=v.prototype;m.isTransparent=function(){return this.opacity<1},m.isOpaque=function(){return this.opacity>=1},m.pickSlots=1,m.setPickBase=function(t){this.pickId=t},m.drawTransparent=m.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||h,view:t.view||h,projection:t.projection||h,clipBounds:p(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()},m.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||h,view:t.view||h,projection:t.projection||h,pickId:this.pickId,clipBounds:p(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()},m.update=function(t){var e,r;this.dirty=!0;var n=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var i=t.position||t.positions;if(i){var a=t.color||t.colors||[0,0,0,1],o=t.lineWidth||1,u=[],c=[],f=[],h=0,p=0,g=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],v=!1;t:for(e=1;e0){for(var w=0;w<24;++w)u.push(u[u.length-12]);p+=2,v=!0}continue t}g[0][r]=Math.min(g[0][r],x[r],_[r]),g[1][r]=Math.max(g[1][r],x[r],_[r])}Array.isArray(a[0])?(m=a[e-1],y=a[e]):m=y=a,3===m.length&&(m=[m[0],m[1],m[2],1]),3===y.length&&(y=[y[0],y[1],y[2],1]),b=Array.isArray(o)?o[e-1]:o;var M=h;if(h+=d(x,_),v){for(r=0;r<2;++r)u.push(x[0],x[1],x[2],_[0],_[1],_[2],M,b,m[0],m[1],m[2],m[3]);p+=2,v=!1}u.push(x[0],x[1],x[2],_[0],_[1],_[2],M,b,m[0],m[1],m[2],m[3],x[0],x[1],x[2],_[0],_[1],_[2],M,-b,m[0],m[1],m[2],m[3],_[0],_[1],_[2],x[0],x[1],x[2],h,-b,y[0],y[1],y[2],y[3],_[0],_[1],_[2],x[0],x[1],x[2],h,b,y[0],y[1],y[2],y[3]),p+=4}if(this.buffer.update(u),c.push(h),f.push(i[i.length-1].slice()),this.bounds=g,this.vertexCount=p,this.points=f,this.arcLength=c,"dashes"in t){var A=t.dashes.slice();for(A.unshift(0),e=1;e1.0001)return null;v+=g[c]}if(Math.abs(v-1)>.001)return null;return[f,function(t,e){for(var r=[0,0,0],n=0;n 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]),c=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}"]),f=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]),h=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}"]),d=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}"]),p=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:l,fragment:u,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:c,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:d,fragment:p,attributes:[{name:"position",type:"vec3"}]}},{glslify:230}],138:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("normals"),l=t("gl-mat4/multiply"),u=t("gl-mat4/invert"),c=t("ndarray"),f=t("colormap"),h=t("simplicial-complex-contour"),d=t("typedarray-pool"),p=t("./lib/shaders"),g=t("./lib/closest-point"),v=p.meshShader,m=p.wireShader,y=p.pointShader,b=p.pickShader,x=p.pointPickShader,_=p.contourShader,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function M(t,e,r,n,i,a,o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,M,A,T,k,E){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=h,this.triangleUVs=f,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=v,this.edgeUVs=m,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=M,this.pointSizes=A,this.pointIds=x,this.pointVAO=T,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=E,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=w,this._view=w,this._projection=w,this._resolution=[1,1]}var A=M.prototype;function T(t){var e=n(t,y.vertex,y.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}function k(t){var e=n(t,b.vertex,b.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e}function E(t){var e=n(t,x.vertex,x.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function S(t){var e=n(t,_.vertex,_.fragment);return e.attributes.position.location=0,e}A.isOpaque=function(){return this.opacity>=1},A.isTransparent=function(){return this.opacity<1},A.pickSlots=1,A.setPickBase=function(t){this.pickId=t},A.highlight=function(t){if(t&&this.contourEnable){for(var e=h(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=d.mallocFloat32(6*a),s=0,l=0;l0&&((f=this.triShader).bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind());this.edgeCount>0&&this.lineWidth>0&&((f=this.lineShader).bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind());this.pointCount>0&&((f=this.pointShader).bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind());this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0&&((f=this.contourShader).bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind())},A.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||w,n=t.view||w,i=t.projection||w,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s,l={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255};((s=this.pickShader).bind(),s.uniforms=l,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0)&&((s=this.pointPickShader).bind(),s.uniforms=l,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind())},A.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),a=0;a0&&0===C[e-1];)C.pop(),P.pop().dispose()}window.addEventListener("resize",B),F.update=function(t){e||(t=t||{},O=!0,R=!0)},F.add=function(t){e||(t.axes=T,S.push(t),L.push(-1),O=!0,R=!0,U())},F.remove=function(t){if(!e){var r=S.indexOf(t);r<0||(S.splice(r,1),L.pop(),O=!0,R=!0,U())}},F.dispose=function(){if(!e&&(e=!0,window.removeEventListener("resize",B),r.removeEventListener("webglcontextlost",q),F.mouseListener.enabled=!1,!F.contextLost)){T.dispose(),E.dispose();for(var t=0;tx.distance)continue;for(var c=0;c0){r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function v(t){return"boolean"!=typeof t||t}},{"./lib/shader":139,"3d-view-controls":9,"a-big-triangle":11,"gl-axes3d":95,"gl-axes3d/properties":102,"gl-fbo":112,"gl-mat4/perspective":127,"gl-select-static":145,"gl-spikes3d":154,"is-mobile":240,"mouse-change":250}],141:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],f=e[2],h=e[3],d=r[0],p=r[1],g=r[2],v=r[3];(a=u*d+c*p+f*g+h*v)<0&&(a=-a,d=-d,p=-p,g=-g,v=-v);1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n);return t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*g,t[3]=s*h+l*v,t}},{}],142:[function(t,e,r){"use strict";var n=t("vectorize-text");e.exports=function(t,e){var r=i[e];r||(r=i[e]={});if(t in r)return r[t];for(var a=n(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=n(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-1/0,-1/0]],l=0;l=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var g=[0,0],v=[0,0,0],m=[0,0,0],y=[0,0,0,1],b=[0,0,0,1],x=u.slice(),_=[0,0,0],w=[[0,0,0],[0,0,0]];function M(t){return t[0]=t[1]=t[2]=0,t}function A(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function T(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function k(t,e,r,n,i){var a,s=e.axesProject,l=e.gl,c=t.uniforms,h=r.model||u,d=r.view||u,p=r.projection||u,k=e.axesBounds,E=function(t){for(var e=w,r=0;r<2;++r)for(var n=0;n<3;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}(e.clipBounds);a=e.axes&&e.axes.lastCubeProps?e.axes.lastCubeProps.axis:[1,1,1],g[0]=2/l.drawingBufferWidth,g[1]=2/l.drawingBufferHeight,t.bind(),c.view=d,c.projection=p,c.screenSize=g,c.highlightId=e.highlightId,c.highlightScale=e.highlightScale,c.clipBounds=E,c.pickGroup=e.pickId/255,c.pixelRatio=e.pixelRatio;for(var S=0;S<3;++S)if(s[S]&&e.projectOpacity[S]<1===n){c.scale=e.projectScale[S],c.opacity=e.projectOpacity[S];for(var L=x,C=0;C<16;++C)L[C]=0;for(C=0;C<4;++C)L[5*C]=1;L[5*S]=0,a[S]<0?L[12+S]=k[0][S]:L[12+S]=k[1][S],o(L,h,L),c.model=L;var P=(S+1)%3,O=(S+2)%3,R=M(v),I=M(m);R[P]=1,I[O]=1;var N=f(0,0,0,A(y,R)),z=f(0,0,0,A(b,I));if(Math.abs(N[1])>Math.abs(z[1])){var D=N;N=z,z=D,D=R,R=I,I=D;var F=P;P=O,O=F}N[0]<0&&(R[P]=-1),z[1]>0&&(I[O]=-1);var j=0,B=0;for(C=0;C<4;++C)j+=Math.pow(h[4*P+C],2),B+=Math.pow(h[4*O+C],2);R[P]/=Math.sqrt(j),I[O]/=Math.sqrt(B),c.axes[0]=R,c.axes[1]=I,c.fragClipBounds[0]=T(_,E[0],S,-1e8),c.fragClipBounds[1]=T(_,E[1],S,1e8),e.vao.draw(l.TRIANGLES,e.vertexCount),e.lineWidth>0&&(l.lineWidth(e.lineWidth),e.vao.draw(l.LINES,e.lineVertexCount,e.vertexCount))}}var E=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];function S(t,e,r,n,i,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||u,s.view=n.view||u,s.projection=n.projection||u,g[0]=2/o.drawingBufferWidth,g[1]=2/o.drawingBufferHeight,s.screenSize=g,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=E,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(o.TRIANGLES,r.vertexCount),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}k(e,r,n,i),r.vao.unbind()}p.draw=function(t){S(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},p.drawTransparent=function(t){S(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},p.drawPick=function(t){S(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,this.pickProjectShader,this,t,!1,!0)},p.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},p.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},p.update=function(t){if("perspective"in(t=t||{})&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",o=t.alignment||[0,0],s=[1/0,1/0,1/0],u=[-1/0,-1/0,-1/0],c=t.glyph,f=t.color,h=t.size,d=t.angle,p=t.lineColor,g=0,v=0,m=0,y=n.length;t:for(var b=0;b0&&(C[0]=-o[0]*(1+A[0][0]));var H=w.cells,q=w.positions;for(_=0;_this.buffer.length){i.free(this.buffer);for(var n=this.buffer=i.mallocUint8(o(r*e*4)),a=0;ar)for(t=r;te)for(t=e;t=0){for(var M=0|w.type.charAt(w.type.length-1),A=new Array(M),T=0;T=0;)k+=1;_[y]=k}var E=new Array(r.length);function S(){h.program=o.program(d,h._vref,h._fref,x,_);for(var t=0;t=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new n("","Invalid data type for attribute "+f+": "+h);o(t,e,d[0],i,p,a,f)}else{if(!(h.indexOf("mat")>=0))throw new n("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new n("","Invalid data type for attribute "+f+": "+h);s(t,e,d,i,p,a,f)}}}return a};var n=t("./GLError");function i(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}var a=i.prototype;function o(t,e,r,n,a,o,s){for(var l=["gl","v"],u=[],c=0;c4)throw new i("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+a+"fv(locations["+e+"],false,obj"+t+")"}throw new i("","Unknown uniform data type for "+name+": "+r)}var a=r.charCodeAt(r.length-1)-48;if(a<2||a>4)throw new i("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+a+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+a+"fv(locations["+e+"],obj"+t+")";default:throw new i("","Unrecognized data type for vector "+name+": "+r)}}}function u(e){for(var n=["return function updateProperty(obj){"],i=function t(e,r){if("object"!=typeof r)return[[e,r]];var n=[];for(var i in r){var a=r[i],o=e;parseInt(i)+""===i?o+="["+i+"]":o+="."+i,"object"==typeof a?n.push.apply(n,t(o,a)):n.push([o,a])}return n}("",e),a=0;a4)throw new i("","Invalid data type");return"b"===t.charAt(0)?o(r,!1):o(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new i("","Invalid uniform dimension type for matrix "+name+": "+t);return o(r*r,0)}throw new i("","Unknown uniform data type for "+name+": "+t)}}(r[c].type);var d}function f(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var u=1;u1)for(var l=0;l 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = max(beckmannSpecular(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor = step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + step(.5, vertexColor) * vColor;\n\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n"]),s=i(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n"]),l=i(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n"]);r.createShader=function(t){var e=n(t,a,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,a,l,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,s,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,s,l,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":146,glslify:230}],156:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=y(e),n=x(e),s=b(e),l=_(e),u=i(e),c=a(e,[{buffer:u,size:4,stride:w,offset:0},{buffer:u,size:3,stride:w,offset:16},{buffer:u,size:3,stride:w,offset:28}]),f=i(e),h=a(e,[{buffer:f,size:4,stride:20,offset:0},{buffer:f,size:1,stride:20,offset:16}]),d=i(e),p=a(e,[{buffer:d,size:2,type:e.FLOAT}]),g=o(e,1,E,e.RGBA,e.UNSIGNED_BYTE);g.minFilter=e.LINEAR,g.magFilter=e.LINEAR;var v=new S(e,[0,0],[[0,0,0],[0,0,0]],r,n,u,c,g,s,l,f,h,d,p),m={levels:[[],[],[]]};for(var M in t)m[M]=t[M];return m.colormap=m.colormap||"jet",v.update(m),v};var n=t("bit-twiddle"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("typedarray-pool"),l=t("colormap"),u=t("ndarray-ops"),c=t("ndarray-pack"),f=t("ndarray"),h=t("surface-nets"),d=t("gl-mat4/multiply"),p=t("gl-mat4/invert"),g=t("binary-search-bounds"),v=t("ndarray-gradient"),m=t("./lib/shaders"),y=m.createShader,b=m.createContourShader,x=m.createPickShader,_=m.createPickContourShader,w=40,M=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],A=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],T=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];function k(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}!function(){for(var t=0;t<3;++t){var e=T[t],r=(t+2)%3;e[(t+1)%3+0]=1,e[r+3]=1,e[t+6]=1}}();var E=256;function S(t,e,r,n,i,a,o,l,u,c,h,d,p,g){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=n,this._pickShader=i,this._coordinateBuffer=a,this._vao=o,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=d,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new k([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=p,this._dynamicVAO=g,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[f(s.mallocFloat(1024),[0,0]),f(s.mallocFloat(1024),[0,0]),f(s.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}var L=S.prototype;L.isTransparent=function(){return this.opacity<1},L.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},L.pickSlots=1,L.setPickBase=function(t){this.pickId=t};var C=[0,0,0],P={showSurface:!1,showContour:!1,projections:[M.slice(),M.slice(),M.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function O(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||C,o=e.showSurface,s=e.showContour;for(r=0;r<3;++r)for(o=o||e.surfaceProject[r],n=0;n<3;++n)s=s||e.contourProject[r][n];for(r=0;r<3;++r){var l=P.projections[r];for(n=0;n<16;++n)l[n]=0;for(n=0;n<4;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(a[r]>0)][r],d(l,t.model,l);var u=P.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return P.showSurface=o,P.showContour=s,P}var R={model:M,view:M,projection:M,inverseModel:M.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},I=M.slice(),N=[1,0,0,0,1,0,0,0,1];function z(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=R;n.model=t.model||M,n.view=t.view||M,n.projection=t.projection||M,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=p(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],o=0;o<3;++o)a[o]=Math.min(Math.max(this.clipBounds[i][o],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=N,n.vertexColor=this.vertexColor;var s=I;for(d(s,n.view,n.model),d(s,n.projection,s),p(s,s),i=0;i<3;++i)n.eyePosition[i]=s[12+i]/s[15];var l=s[15];for(i=0;i<3;++i)l+=this.lightPosition[i]*s[4*i+3];for(i=0;i<3;++i){var u=s[12+i];for(o=0;o<3;++o)u+=s[4*o+i]*this.lightPosition[o];n.lightPosition[i]=u/l}var c=O(n,this);if(c.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;i<3;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=c.projections[i],this._shader.uniforms.clipBounds=c.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(c.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var h=this._contourVAO;for(h.bind(),i=0;i<3;++i)for(f.uniforms.permutation=T[i],r.lineWidth(this.contourWidth[i]),o=0;o>4)/16)/255,i=Math.floor(n),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var f=c?a:1-a,h=0;h<2;++h)for(var d=i+c,p=s+h,v=f*(h?l:1-l),m=0;m<3;++m)u[m]+=this._field[m].get(d,p)*v;for(var y=this._pickResult.level,b=0;b<3;++b)if(y[b]=g.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]Math.abs(_-u[b])&&(y[b]+=1)}for(r.index[0]=a<.5?i:i+1,r.index[1]=l<.5?s:s+1,r.uv[0]=n/e[0],r.uv[1]=o/e[1],m=0;m<3;++m)r.dataCoordinate[m]=this._field[m].get(r.index[0],r.index[1]);return r},L.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=j(t.contourWidth,Number)),"showContour"in t&&(this.showContour=j(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=j(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=U(t.contourColor)),"contourProject"in t&&(this.contourProject=j(t.contourProject,function(t){return j(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=U(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=j(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=j(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var i=(e.shape[0]+2)*(e.shape[1]+2);i>this._field[2].data.length&&(s.freeFloat(this._field[2].data),this._field[2].data=s.mallocFloat(n.nextPow2(i))),this._field[2]=f(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),F(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(s.freeFloat(this._field[o].data),this._field[o].data=s.mallocFloat(this._field[2].size)),this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var d=t.coords;if(!Array.isArray(d)||3!==d.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var p=d[o];for(x=0;x<2;++x)if(p.shape[x]!==a[x])throw new Error("gl-surface: coords have incorrect shape");F(this._field[o],p)}}else if(t.ticks){var g=t.ticks;if(!Array.isArray(g)||2!==g.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var m=g[o];if((Array.isArray(m)||m.length)&&(m=f(m)),m.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var y=f(m.data,a);y.stride[o]=m.stride[0],y.stride[1^o]=0,F(this._field[o],y)}}else{for(o=0;o<2;++o){var b=[0,0];b[o]=1,this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2],b,0)}this._field[0].set(0,0,0);for(var x=0;x0){for(var Mt=0;Mt<5;++Mt)nt.pop();X-=1}continue t}nt.push(st[0],st[1],ct[0],ct[1],st[2]),X+=1}}ot.push(X)}this._contourOffsets[it]=at,this._contourCounts[it]=ot}var At=s.mallocFloat(nt.length);for(o=0;os||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=p(o,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,l=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,l=!1,r="uint8");var f,d,v=0;if(2===o.length)v=t.LUMINANCE,o=[o[0],o[1],1],e=n(e.data,o,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==o.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===o[2])v=t.ALPHA;else if(2===o[2])v=t.LUMINANCE_ALPHA;else if(3===o[2])v=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");v=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,l=!1);var m=e.size;if(l)f=0===e.offset&&e.data.length===m?e.data:e.data.subarray(e.offset,e.offset+m);else{var y=[o[2],o[2]*o[0],1];d=a.malloc(m,r);var b=n(d,o,y,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?i.assign(b,e):c(b,e),f=d.subarray(0,m)}var x=g(t);t.texImage2D(t.TEXTURE_2D,0,v,o[0],o[1],0,v,u,f),l||a.free(d);return new h(t,x,o[0],o[1],v,u)}(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var o=null,s=null,l=null;function u(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement||"undefined"!=typeof ImageData&&t instanceof ImageData}var c=function(t,e){i.muls(t,e,255)};function f(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function h(t,e,r,n,i,a){this.gl=t,this.handle=e,this.format=i,this.type=a,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return o._wrapS},set:function(t){return o.wrapS=t}},{get:function(){return o._wrapT},set:function(t){return o.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(t){return o.width=t}},{get:function(){return o._shape[1]},set:function(t){return o.height=t}}]),this._shapeVector=l}var d=h.prototype;function p(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function g(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function v(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=g(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new h(t,o,e,r,n,i)}Object.defineProperties(d,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&o.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),s.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&o.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),s.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=this.gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),l.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),l.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(l.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return f(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return f(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,f(this,this._shape[0],t),t}}}),d.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},d.dispose=function(){this.gl.deleteTexture(this.handle)},d.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},d.setPixels=function(t,e,r,o){var s=this.gl;this.bind(),Array.isArray(e)?(o=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),o=o||0;var l=u(t)?t:t.raw;if(l){this._mipLevels.indexOf(o)<0?(s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,this.type,l),this._mipLevels.push(o)):s.texSubImage2D(s.TEXTURE_2D,o,e,r,this.format,this.type,l)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>o||r+t.shape[0]>this._shape[0]>>>o||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");!function(t,e,r,o,s,l,u,f){var h=f.dtype,d=f.shape.slice();if(d.length<2||d.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var g=0,v=0,m=p(d,f.stride.slice());"float32"===h?g=t.FLOAT:"float64"===h?(g=t.FLOAT,m=!1,h="float32"):"uint8"===h?g=t.UNSIGNED_BYTE:(g=t.UNSIGNED_BYTE,m=!1,h="uint8");if(2===d.length)v=t.LUMINANCE,d=[d[0],d[1],1],f=n(f.data,d,[f.stride[0],f.stride[1],1],f.offset);else{if(3!==d.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===d[2])v=t.ALPHA;else if(2===d[2])v=t.LUMINANCE_ALPHA;else if(3===d[2])v=t.RGB;else{if(4!==d[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");v=t.RGBA}d[2]}v!==t.LUMINANCE&&v!==t.ALPHA||s!==t.LUMINANCE&&s!==t.ALPHA||(v=s);if(v!==s)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=f.size,b=u.indexOf(o)<0;b&&u.push(o);if(g===l&&m)0===f.offset&&f.data.length===y?b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,f.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,f.data):b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,f.data.subarray(f.offset,f.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,f.data.subarray(f.offset,f.offset+y));else{var x;x=l===t.FLOAT?a.mallocFloat32(y):a.mallocUint8(y);var _=n(x,d,[d[2],d[2]*d[0],1]);g===t.FLOAT&&l===t.UNSIGNED_BYTE?c(_,f):i.assign(_,f),b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,x.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,x.subarray(0,y)),l===t.FLOAT?a.freeFloat32(x):a.freeUint8(x)}}(s,e,r,o,this.format,this.type,this._mipLevels,t)}}},{ndarray:265,"ndarray-ops":259,"typedarray-pool":328}],158:[function(t,e,r){"use strict";e.exports=function(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i1?0:Math.acos(s)};var n=t("./fromValues"),i=t("./normalize"),a=t("./dot")},{"./dot":170,"./fromValues":172,"./normalize":181}],164:[function(t,e,r){e.exports=function(t){var e=new Float32Array(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}},{}],165:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}},{}],166:[function(t,e,r){e.exports=function(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}},{}],167:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=i*l-a*s,t[1]=a*o-n*l,t[2]=n*s-i*o,t}},{}],168:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(r*r+n*n+i*i)}},{}],169:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}},{}],170:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],171:[function(t,e,r){e.exports=function(t,e,r,i,a,o){var s,l;e||(e=3);r||(r=0);l=i?Math.min(i*e+r,t.length):t.length;for(s=r;s0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a);return t}},{}],182:[function(t,e,r){e.exports=function(t,e){e=e||1;var r=2*Math.random()*Math.PI,n=2*Math.random()-1,i=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*i,t[1]=Math.sin(r)*i,t[2]=n*e,t}},{}],183:[function(t,e,r){e.exports=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t}},{}],184:[function(t,e,r){e.exports=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t}},{}],185:[function(t,e,r){e.exports=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t}},{}],186:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}},{}],187:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}},{}],188:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}},{}],189:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}},{}],190:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}},{}],191:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}},{}],192:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2];return t[0]=n*r[0]+i*r[3]+a*r[6],t[1]=n*r[1]+i*r[4]+a*r[7],t[2]=n*r[2]+i*r[5]+a*r[8],t}},{}],193:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,t}},{}],194:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,f=u*i+l*n-o*a,h=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t}},{}],195:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}},{}],196:[function(t,e,r){e.exports=function(t){var e=new Float32Array(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}},{}],197:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}},{}],198:[function(t,e,r){e.exports=function(){var t=new Float32Array(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}},{}],199:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)}},{}],200:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}},{}],201:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}},{}],202:[function(t,e,r){e.exports=function(t,e,r,n){var i=new Float32Array(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}},{}],203:[function(t,e,r){e.exports={create:t("./create"),clone:t("./clone"),fromValues:t("./fromValues"),copy:t("./copy"),set:t("./set"),add:t("./add"),subtract:t("./subtract"),multiply:t("./multiply"),divide:t("./divide"),min:t("./min"),max:t("./max"),scale:t("./scale"),scaleAndAdd:t("./scaleAndAdd"),distance:t("./distance"),squaredDistance:t("./squaredDistance"),length:t("./length"),squaredLength:t("./squaredLength"),negate:t("./negate"),inverse:t("./inverse"),normalize:t("./normalize"),dot:t("./dot"),lerp:t("./lerp"),random:t("./random"),transformMat4:t("./transformMat4"),transformQuat:t("./transformQuat")}},{"./add":195,"./clone":196,"./copy":197,"./create":198,"./distance":199,"./divide":200,"./dot":201,"./fromValues":202,"./inverse":204,"./length":205,"./lerp":206,"./max":207,"./min":208,"./multiply":209,"./negate":210,"./normalize":211,"./random":212,"./scale":213,"./scaleAndAdd":214,"./set":215,"./squaredDistance":216,"./squaredLength":217,"./subtract":218,"./transformMat4":219,"./transformQuat":220}],204:[function(t,e,r){e.exports=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}},{}],205:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)}},{}],206:[function(t,e,r){e.exports=function(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t}},{}],207:[function(t,e,r){e.exports=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}},{}],208:[function(t,e,r){e.exports=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}},{}],209:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}},{}],210:[function(t,e,r){e.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}},{}],211:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a;o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o);return t}},{}],212:[function(t,e,r){var n=t("./normalize"),i=t("./scale");e.exports=function(t,e){return e=e||1,t[0]=Math.random(),t[1]=Math.random(),t[2]=Math.random(),t[3]=Math.random(),n(t,t),i(t,t,e),t}},{"./normalize":211,"./scale":213}],213:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}},{}],214:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}},{}],215:[function(t,e,r){e.exports=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}},{}],216:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return r*r+n*n+i*i+a*a}},{}],217:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}},{}],218:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}},{}],219:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}},{}],220:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,f=u*i+l*n-o*a,h=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t[3]=e[3],t}},{}],221:[function(t,e,r){e.exports=function(t,e,r,a){return n[0]=a,n[1]=r,n[2]=e,n[3]=t,i[0]};var n=new Uint8Array(4),i=new Float32Array(n.buffer)},{}],222:[function(t,e,r){var n=t("glsl-tokenizer"),i=t("atob-lite");e.exports=function(t){for(var e=Array.isArray(t)?t:n(t),r=0;r0)continue;r=t.slice(0,1).join("")}return D(r),P+=r.length,(E=E.slice(r.length)).length}}function q(){return/[^a-fA-F0-9]/.test(e)?(D(E.join("")),k=l,A):(E.push(e),r=e,A+1)}function G(){return"."===e?(E.push(e),k=g,r=e,A+1):/[eE]/.test(e)?(E.push(e),k=g,r=e,A+1):"x"===e&&1===E.length&&"0"===E[0]?(k=_,E.push(e),r=e,A+1):/[^\d]/.test(e)?(D(E.join("")),k=l,A):(E.push(e),r=e,A+1)}function X(){return"f"===e&&(E.push(e),r=e,A+=1),/[eE]/.test(e)?(E.push(e),r=e,A+1):"-"===e&&/[eE]/.test(r)?(E.push(e),r=e,A+1):/[^\d]/.test(e)?(D(E.join("")),k=l,A):(E.push(e),r=e,A+1)}function W(){if(/[^\d\w_]/.test(e)){var t=E.join("");return k=z.indexOf(t)>-1?y:N.indexOf(t)>-1?m:v,D(E.join("")),k=l,A}return E.push(e),r=e,A+1}};var n=t("./lib/literals"),i=t("./lib/operators"),a=t("./lib/builtins"),o=t("./lib/literals-300es"),s=t("./lib/builtins-300es"),l=999,u=9999,c=0,f=1,h=2,d=3,p=4,g=5,v=6,m=7,y=8,b=9,x=10,_=11,w=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":225,"./lib/builtins-300es":224,"./lib/literals":227,"./lib/literals-300es":226,"./lib/operators":228}],224:[function(t,e,r){var n=t("./builtins");n=n.slice().filter(function(t){return!/^(gl\_|texture)/.test(t)}),e.exports=n.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":225}],225:[function(t,e,r){e.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]},{}],226:[function(t,e,r){var n=t("./literals");e.exports=n.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":227}],227:[function(t,e,r){e.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},{}],228:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],229:[function(t,e,r){var n=t("./index");e.exports=function(t,e){var r=n(e),i=[];return i=(i=i.concat(r(t))).concat(r(null))}},{"./index":223}],230:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(e*l-1)*Math.pow(2,i),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],234:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var o=t.slice(0,i+1),s=n.apply(void 0,o);if(0===s)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;s<0&&(l[0]=1,l[1]=0);for(var f=new a(l,new Array(i+1),!1),h=f.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var v=p[0];p[0]=p[1],p[1]=v;var m=new a(p,new Array(i+1),!0);h[c]=m,d[c]=m}d[i+1]=f;for(var c=0;c<=i;++c)for(var p=h[c].vertices,y=h[c].adjacent,g=0;g<=i;++g){var b=p[g];if(b<0)y[g]=f;else for(var x=0;x<=i;++x)h[x].vertices.indexOf(b)<0&&(y[g]=h[x])}for(var _=new u(i,o,d),w=!!e,c=i+1;c0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var i=new Function("test",e.join("")),a=n[t+1];return a||(a=n),i(a)}(t)),this.orient=a}var c=u.prototype;c.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,a=this.vertices,o=[t];for(t.lastVisited=-n;o.length>0;){(t=o.pop()).vertices;for(var s=t.adjacent,l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,f=0;f<=r;++f){var h=c[f];i[f]=h<0?e:a[h]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},c.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[o];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(c=0;c<=n;++c){var f=u[c];if(!(f.lastVisited>=r)){var h=a[c];a[c]=t;var d=this.orient();if(a[c]=h,d<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},c.addPeaks=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var h=[];f.length>0;){var d=(e=f.pop()).vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var v=0;v<=n;++v)if(v!==g){var m=p[v];if(m.boundary&&!(m.lastVisited>=r)){var y=m.vertices;if(m.lastVisited!==-r){for(var b=0,x=0;x<=n;++x)y[x]<0?(b=x,l[x]=t):l[x]=i[y[x]];if(this.orient()>0){y[b]=r,m.boundary=!1,u.push(m),f.push(m),m.lastVisited=r;continue}m.lastVisited=-r}var _=m.adjacent,w=d.slice(),M=p.slice(),A=new a(w,M,!0);c.push(A);var T=_.indexOf(e);if(!(T<0)){_[T]=A,M[g]=m,w[v]=-1,M[v]=e,p[v]=A,A.flip();for(x=0;x<=n;++x){var k=w[x];if(!(k<0||k===r)){for(var E=new Array(n-1),S=0,L=0;L<=n;++L){var C=w[L];C<0||L===x||(E[S++]=C)}h.push(new o(E,A,x))}}}}}}h.sort(s);for(v=0;v+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":301,"simplicial-complex":311}],235:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),i=0,a=1;function o(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}e.exports=function(t){if(!t||0===t.length)return new b(null);return new b(y(t))};var s=o.prototype;function l(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function u(t,e){var r=y(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function c(t,e){var r=t.intervals([]);r.push(e),u(t,r)}function f(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?i:(r.splice(n,1),u(t,r),a)}function h(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function p(t,e){for(var r=0;r>1],i=[],a=[],s=[];for(r=0;r3*(e+1)?c(this,t):this.left.insert(t):this.left=y([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?c(this,t):this.right.insert(t):this.right=y([t]);else{var r=n.ge(this.leftPoints,t,v),i=n.ge(this.rightPoints,t,m);this.leftPoints.splice(r,0,t),this.rightPoints.splice(i,0,t)}},s.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?f(this,t):2===(u=this.left.remove(t))?(this.left=null,this.count-=1,a):(u===a&&(this.count-=1),u):i;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?f(this,t):2===(u=this.right.remove(t))?(this.right=null,this.count-=1,a):(u===a&&(this.count-=1),u):i;if(1===this.count)return this.leftPoints[0]===t?2:i;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,o=this.left;o.right;)r=o,o=o.right;if(r===this)o.right=this.right;else{var s=this.left,u=this.right;r.count-=o.count,r.right=o.left,o.left=s,o.right=u}l(this,o),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?l(this,this.left):l(this,this.right);return a}for(s=n.ge(this.leftPoints,t,v);sthis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return d(this.rightPoints,t,e)}return p(this.leftPoints,e)},s.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?d(this.rightPoints,t,r):p(this.leftPoints,r)};var x=b.prototype;x.insert=function(t){this.root?this.root.insert(t):this.root=new o(t[0],null,null,[t],[t])},x.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==i}return!1},x.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},x.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(x,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(x,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":35}],236:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;rd[1][2]&&(m[0]=-m[0]),d[0][2]>d[2][0]&&(m[1]=-m[1]),d[1][0]>d[0][1]&&(m[2]=-m[2]),!0}},{"./normalize":245,"gl-mat4/clone":118,"gl-mat4/create":119,"gl-mat4/determinant":120,"gl-mat4/invert":124,"gl-mat4/transpose":134,"gl-vec3/cross":167,"gl-vec3/dot":170,"gl-vec3/length":175,"gl-vec3/normalize":181}],245:[function(t,e,r){e.exports=function(t,e){var r=e[15];if(0===r)return!1;for(var n=1/r,i=0;i<16;i++)t[i]=e[i]*n;return!0}},{}],246:[function(t,e,r){var n=t("gl-vec3/lerp"),i=t("mat4-recompose"),a=t("mat4-decompose"),o=t("gl-mat4/determinant"),s=t("quat-slerp"),l=f(),u=f(),c=f();function f(){return{translate:h(),scale:h(1),skew:h(),perspective:[0,0,0,1],quaternion:[0,0,0,1]}}function h(t){return[t||0,t||0,t||0]}e.exports=function(t,e,r,f){if(0===o(e)||0===o(r))return!1;var h=a(e,l.translate,l.scale,l.skew,l.perspective,l.quaternion),d=a(r,u.translate,u.scale,u.skew,u.perspective,u.quaternion);return!(!h||!d||(n(c.translate,l.translate,u.translate,f),n(c.skew,l.skew,u.skew,f),n(c.scale,l.scale,u.scale,f),n(c.perspective,l.perspective,u.perspective,f),s(c.quaternion,l.quaternion,u.quaternion,f),i(t,c.translate,c.scale,c.skew,c.perspective,c.quaternion),0))}},{"gl-mat4/determinant":120,"gl-vec3/lerp":176,"mat4-decompose":244,"mat4-recompose":247,"quat-slerp":288}],247:[function(t,e,r){var n={identity:t("gl-mat4/identity"),translate:t("gl-mat4/translate"),multiply:t("gl-mat4/multiply"),create:t("gl-mat4/create"),scale:t("gl-mat4/scale"),fromRotationTranslation:t("gl-mat4/fromRotationTranslation")},i=(n.create(),n.create());e.exports=function(t,e,r,a,o,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=o[0],t[7]=o[1],t[11]=o[2],t[15]=o[3],n.identity(i),0!==a[2]&&(i[9]=a[2],n.multiply(t,t,i)),0!==a[1]&&(i[9]=0,i[8]=a[1],n.multiply(t,t,i)),0!==a[0]&&(i[8]=0,i[4]=a[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":119,"gl-mat4/fromRotationTranslation":122,"gl-mat4/identity":123,"gl-mat4/multiply":126,"gl-mat4/scale":132,"gl-mat4/translate":133}],248:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),i=t("mat4-interpolate"),a=t("gl-mat4/invert"),o=t("gl-mat4/rotateX"),s=t("gl-mat4/rotateY"),l=t("gl-mat4/rotateZ"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/translate"),f=(t("gl-mat4/scale"),t("gl-vec3/normalize")),h=[0,0,0];function d(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-1/0,1/0]}e.exports=function(t){return new d((t=t||{}).matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};var p=d.prototype;p.recalcMatrix=function(t){var e=this._time,r=n.le(e,t),o=this.computedMatrix;if(!(r<0)){var s=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)o[u]=s[l++];else{var c=e[r+1]-e[r],h=(l=16*r,this.prevMatrix),d=!0;for(u=0;u<16;++u)h[u]=s[l++];var p=this.nextMatrix;for(u=0;u<16;++u)p[u]=s[l++],d=d&&h[u]===p[u];if(c<1e-6||d)for(u=0;u<16;++u)o[u]=h[u];else i(o,h,p,(t-e[r])/c)}var g=this.computedUp;g[0]=o[1],g[1]=o[5],g[2]=o[9],f(g,g);var v=this.computedInverse;a(v,o);var m=this.computedEye,y=v[15];m[0]=v[12]/y,m[1]=v[13]/y,m[2]=v[14]/y;var b=this.computedCenter,x=Math.exp(this.computedRadius[0]);for(u=0;u<3;++u)b[u]=m[u]-o[2+4*u]*x}},p.idle=function(t){if(!(t1&&n(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(l),c=s.length;c>1&&n(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+o.length-2),f=0,i=0,h=o.length;i0;--d)r[f++]=s[d];return r};var n=t("robust-orientation")[3]},{"robust-orientation":301}],250:[function(t,e,r){"use strict";e.exports=function(t,e){e||(e=t,t=window);var r=0,i=0,a=0,o={shift:!1,alt:!1,control:!1,meta:!1},s=!1;function l(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==o.alt,o.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==o.shift,o.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==o.control,o.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==o.meta,o.meta=!!t.metaKey),e}function u(t,s){var u=n.x(s),c=n.y(s);"buttons"in s&&(t=0|s.buttons),(t!==r||u!==i||c!==a||l(s))&&(r=0|t,i=u||0,a=c||0,e&&e(r,i,a,o))}function c(t){u(0,t)}function f(){(r||i||a||o.shift||o.alt||o.meta||o.control)&&(i=a=0,r=0,o.shift=o.alt=o.control=o.meta=!1,e&&e(0,0,0,o))}function h(t){l(t)&&e&&e(r,i,a,o)}function d(t){0===n.buttons(t)?u(0,t):u(r,t)}function p(t){u(r|n.buttons(t),t)}function g(t){u(r&~n.buttons(t),t)}function v(){s||(s=!0,t.addEventListener("mousemove",d),t.addEventListener("mousedown",p),t.addEventListener("mouseup",g),t.addEventListener("mouseleave",c),t.addEventListener("mouseenter",c),t.addEventListener("mouseout",c),t.addEventListener("mouseover",c),t.addEventListener("blur",f),t.addEventListener("keyup",h),t.addEventListener("keydown",h),t.addEventListener("keypress",h),t!==window&&(window.addEventListener("blur",f),window.addEventListener("keyup",h),window.addEventListener("keydown",h),window.addEventListener("keypress",h)))}v();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return s},set:function(e){e?v():s&&(s=!1,t.removeEventListener("mousemove",d),t.removeEventListener("mousedown",p),t.removeEventListener("mouseup",g),t.removeEventListener("mouseleave",c),t.removeEventListener("mouseenter",c),t.removeEventListener("mouseout",c),t.removeEventListener("mouseover",c),t.removeEventListener("blur",f),t.removeEventListener("keyup",h),t.removeEventListener("keydown",h),t.removeEventListener("keypress",h),t!==window&&(window.removeEventListener("blur",f),window.removeEventListener("keyup",h),window.removeEventListener("keydown",h),window.removeEventListener("keypress",h)))},enumerable:!0},buttons:{get:function(){return r},enumerable:!0},x:{get:function(){return i},enumerable:!0},y:{get:function(){return a},enumerable:!0},mods:{get:function(){return o},enumerable:!0}}),m};var n=t("mouse-event")},{"mouse-event":252}],251:[function(t,e,r){var n={left:0,top:0};e.exports=function(t,e,r){e=e||t.currentTarget||t.srcElement,Array.isArray(r)||(r=[0,0]);var i=t.clientX||0,a=t.clientY||0,o=(s=e,s===window||s===document||s===document.body?n:s.getBoundingClientRect());var s;return r[0]=i-o.left,r[1]=a-o.top,r}},{}],252:[function(t,e,r){"use strict";function n(t){return t.target||t.srcElement||window}r.buttons=function(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){if(2===(e=t.which))return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1< 0");"function"!=typeof t.vertex&&e("Must specify vertex creation function");"function"!=typeof t.cell&&e("Must specify cell creation function");"function"!=typeof t.phase&&e("Must specify phase function");for(var S=t.getters||[],L=new Array(k),C=0;C=0?L[C]=!0:L[C]=!1;return function(t,e,r,k,E,S){var L=S.length,C=E.length;if(C<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var P="extractContour"+E.join("_"),O=[],R=[],I=[],N=0;N0&&j.push(l(N,E[z-1])+"*"+s(E[z-1])),R.push(p(N,E[z])+"=("+j.join("-")+")|0")}for(var N=0;N=0;--N)B.push(s(E[N]));R.push(w+"=("+B.join("*")+")|0",x+"=mallocUint32("+w+")",b+"=mallocUint32("+w+")",M+"=0"),R.push(g(0)+"=0");for(var z=1;z<1<0;A=A-1&p)w.push(b+"["+M+"+"+m(A)+"]");w.push(y(0));for(var A=0;A=0;--e)G(e,0);for(var r=[],e=0;e0){",d(E[e]),"=1;");t(e-1,r|1<=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),a.push("1"),o.push("s["+l+"]-2"));var u=".lo("+a.join()+").hi("+o.join()+")";if(0===a.length&&(u=""),i>0){n.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||n.push("&&s[",l,"]>2");n.push("){grad",i,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||n.push(",dst.pick(",s.join(),",",l,")",u);n.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):n.push("if(s[",c,"]>1){diff(",f,",src.pick(",h.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",f,");};");break;case"mirror":0===i?n.push("dst.set(",s.join(),",",c,",0);"):n.push("zero(",f,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===i?n.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):n.push("if(s[",c,"]>2){diff(",f,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",f,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}i>0&&n.push("};")}for(var s=0;s<1<>",rrshift:">>>"};!function(){for(var t in s){var e=s[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var l={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var u={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=n({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=n({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=n({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=n({args:["array","array"],pre:i,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":76}],260:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],a=t,o=1;Array.isArray(a);)r.push(a.length),o*=a.length,a=a[0];return 0===r.length?n():(e||(e=n(new Float64Array(o),r)),i(e,t),e)}},{"./doConvert.js":261,ndarray:265}],261:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":76}],262:[function(t,e,r){"use strict";var n=t("typedarray-pool"),i=32;function a(t){switch(t){case"uint8":return[n.mallocUint8,n.freeUint8];case"uint16":return[n.mallocUint16,n.freeUint16];case"uint32":return[n.mallocUint32,n.freeUint32];case"int8":return[n.mallocInt8,n.freeInt8];case"int16":return[n.mallocInt16,n.freeInt16];case"int32":return[n.mallocInt32,n.freeInt32];case"float32":return[n.mallocFloat,n.freeFloat];case"float64":return[n.mallocDouble,n.freeDouble];default:return null}}function o(t){for(var e=[],r=0;r0?s.push(["d",p,"=s",p,"-d",f,"*n",f].join("")):s.push(["d",p,"=s",p].join("")),f=p),0!=(d=t.length-1-l)&&(h>0?s.push(["e",d,"=s",d,"-e",h,"*n",h,",f",d,"=",u[d],"-f",h,"*n",h].join("")):s.push(["e",d,"=s",d,",f",d,"=",u[d]].join("")),h=d)}r.push("var "+s.join(","));var g=["0","n0-1","data","offset"].concat(o(t.length));r.push(["if(n0<=",i,"){","insertionSort(",g.join(","),")}else{","quickSort(",g.join(","),")}"].join("")),r.push("}return "+n);var v=new Function("insertionSort","quickSort",r.join("\n")),m=function(t,e){var r=["'use strict'"],n=["ndarrayInsertionSort",t.join("d"),e].join(""),i=["left","right","data","offset"].concat(o(t.length)),s=a(e),l=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var u=[],c=1;c1){for(r.push("dptr=0;sptr=ptr"),c=t.length-1;c>=0;--c)0!==(d=t[c])&&r.push(["for(i",d,"=0;i",d,"b){break __l}"].join("")),c=t.length-1;c>=1;--c)r.push("sptr+=e"+c,"dptr+=f"+c,"}");for(r.push("dptr=cptr;sptr=cptr-s0"),c=t.length-1;c>=0;--c)0!==(d=t[c])&&r.push(["for(i",d,"=0;i",d,"=0;--c)0!==(d=t[c])&&r.push(["for(i",d,"=0;i",d,"scratch)){",h("cptr",f("cptr-s0")),"cptr-=s0","}",h("cptr","scratch"));return r.push("}"),t.length>1&&s&&r.push("free(scratch)"),r.push("} return "+n),s?new Function("malloc","free",r.join("\n"))(s[0],s[1]):new Function(r.join("\n"))()}(t,e),y=function(t,e,r){var n=["'use strict'"],s=["ndarrayQuickSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(o(t.length)),u=a(e),c=0;n.push(["function ",s,"(",l.join(","),"){"].join(""));var f=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var h=[],d=1;d=0;--a)0!==(o=t[a])&&n.push(["for(i",o,"=0;i",o,"1)for(a=0;a1?n.push("ptr_shift+=d"+o):n.push("ptr0+=d"+o),n.push("}"))}}function y(e,r,i,a){if(1===r.length)n.push("ptr0="+p(r[0]));else{for(var o=0;o1)for(o=0;o=1;--o)i&&n.push("pivot_ptr+=f"+o),r.length>1?n.push("ptr_shift+=e"+o):n.push("ptr0+=e"+o),n.push("}")}function b(){t.length>1&&u&&n.push("free(pivot1)","free(pivot2)")}function x(e,r){var i="el"+e,a="el"+r;if(t.length>1){var o="__l"+ ++c;y(o,[i,a],!1,["comp=",g("ptr0"),"-",g("ptr1"),"\n","if(comp>0){tmp0=",i,";",i,"=",a,";",a,"=tmp0;break ",o,"}\n","if(comp<0){break ",o,"}"].join(""))}else n.push(["if(",g(p(i)),">",g(p(a)),"){tmp0=",i,";",i,"=",a,";",a,"=tmp0}"].join(""))}function _(e,r){t.length>1?m([e,r],!1,v("ptr0",g("ptr1"))):n.push(v(p(e),g(p(r))))}function w(e,r,i){if(t.length>1){var a="__l"+ ++c;y(a,[r],!0,[e,"=",g("ptr0"),"-pivot",i,"[pivot_ptr]\n","if(",e,"!==0){break ",a,"}"].join(""))}else n.push([e,"=",g(p(r)),"-pivot",i].join(""))}function M(e,r){t.length>1?m([e,r],!1,["tmp=",g("ptr0"),"\n",v("ptr0",g("ptr1")),"\n",v("ptr1","tmp")].join("")):n.push(["ptr0=",p(e),"\n","ptr1=",p(r),"\n","tmp=",g("ptr0"),"\n",v("ptr0",g("ptr1")),"\n",v("ptr1","tmp")].join(""))}function A(e,r,i){t.length>1?(m([e,r,i],!1,["tmp=",g("ptr0"),"\n",v("ptr0",g("ptr1")),"\n",v("ptr1",g("ptr2")),"\n",v("ptr2","tmp")].join("")),n.push("++"+r,"--"+i)):n.push(["ptr0=",p(e),"\n","ptr1=",p(r),"\n","ptr2=",p(i),"\n","++",r,"\n","--",i,"\n","tmp=",g("ptr0"),"\n",v("ptr0",g("ptr1")),"\n",v("ptr1",g("ptr2")),"\n",v("ptr2","tmp")].join(""))}function T(t,e){M(t,e),n.push("--"+e)}function k(e,r,i){t.length>1?m([e,r],!0,[v("ptr0",g("ptr1")),"\n",v("ptr1",["pivot",i,"[pivot_ptr]"].join(""))].join("")):n.push(v(p(e),g(p(r))),v(p(r),"pivot"+i))}function E(e,r){n.push(["if((",r,"-",e,")<=",i,"){\n","insertionSort(",e,",",r,",data,offset,",o(t.length).join(","),")\n","}else{\n",s,"(",e,",",r,",data,offset,",o(t.length).join(","),")\n","}"].join(""))}function S(e,r,i){t.length>1?(n.push(["__l",++c,":while(true){"].join("")),m([e],!0,["if(",g("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",c,"}"].join("")),n.push(i,"}")):n.push(["while(",g(p(e)),"===pivot",r,"){",i,"}"].join(""))}return n.push("var "+f.join(",")),x(1,2),x(4,5),x(1,3),x(2,3),x(1,4),x(3,4),x(2,5),x(2,3),x(4,5),t.length>1?m(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",g("ptr1"),"\n","pivot2[pivot_ptr]=",g("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",g("ptr0"),"\n","y=",g("ptr2"),"\n","z=",g("ptr4"),"\n",v("ptr5","x"),"\n",v("ptr6","y"),"\n",v("ptr7","z")].join("")):n.push(["pivot1=",g(p("el2")),"\n","pivot2=",g(p("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",g(p("el1")),"\n","y=",g(p("el3")),"\n","z=",g(p("el5")),"\n",v(p("index1"),"x"),"\n",v(p("index3"),"y"),"\n",v(p("index5"),"z")].join("")),_("index2","left"),_("index4","right"),n.push("if(pivots_are_equal){"),n.push("for(k=less;k<=great;++k){"),w("comp","k",1),n.push("if(comp===0){continue}"),n.push("if(comp<0){"),n.push("if(k!==less){"),M("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),n.push("while(true){"),w("comp","great",1),n.push("if(comp>0){"),n.push("great--"),n.push("}else if(comp<0){"),A("k","less","great"),n.push("break"),n.push("}else{"),T("k","great"),n.push("break"),n.push("}"),n.push("}"),n.push("}"),n.push("}"),n.push("}else{"),n.push("for(k=less;k<=great;++k){"),w("comp_pivot1","k",1),n.push("if(comp_pivot1<0){"),n.push("if(k!==less){"),M("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),w("comp_pivot2","k",2),n.push("if(comp_pivot2>0){"),n.push("while(true){"),w("comp","great",2),n.push("if(comp>0){"),n.push("if(--greatindex5){"),S("less",1,"++less"),S("great",2,"--great"),n.push("for(k=less;k<=great;++k){"),w("comp_pivot1","k",1),n.push("if(comp_pivot1===0){"),n.push("if(k!==less){"),M("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),w("comp_pivot2","k",2),n.push("if(comp_pivot2===0){"),n.push("while(true){"),w("comp","great",2),n.push("if(comp===0){"),n.push("if(--great1&&u?new Function("insertionSort","malloc","free",n.join("\n"))(r,u[0],u[1]):new Function("insertionSort",n.join("\n"))(r)}(t,e,m);return v(m,y)}},{"typedarray-pool":328}],263:[function(t,e,r){"use strict";var n=t("./lib/compile_sort.js"),i={};e.exports=function(t){var e=t.order,r=t.dtype,a=[e,r].join(":"),o=i[a];return o||(i[a]=o=n(e,r)),o(t),t}},{"./lib/compile_sort.js":262}],264:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate"),i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_39_arg4_)}",args:[{name:"_inline_39_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_39_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_39_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_39_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_39_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_40_arg2_(this_warped,_inline_40_arg0_),_inline_40_arg1_=_inline_40_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_40_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_40_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),a=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_43_arg2_(this_warped,_inline_43_arg0_),_inline_43_arg1_=_inline_43_arg3_(_inline_43_arg4_,this_warped[0])}",args:[{name:"_inline_43_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_43_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),o=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_46_arg2_(this_warped,_inline_46_arg0_),_inline_46_arg1_=_inline_46_arg3_(_inline_46_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_46_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_46_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp2D",blockSize:64}),s=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_49_arg2_(this_warped,_inline_49_arg0_),_inline_49_arg1_=_inline_49_arg3_(_inline_49_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_49_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_49_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_49_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_49_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_49_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:a(t,r,n.d1,e);break;case 2:o(t,r,n.d2,e);break;case 3:s(t,r,n.d3,e);break;default:i(t,r,n.bind(void 0,e),e.shape.length)}return t}},{"cwise/lib/wrapper":79,"ndarray-linear-interpolate":258}],265:[function(t,e,r){var n=t("iota-array"),i=t("is-buffer"),a="undefined"!=typeof Float64Array;function o(t,e){return t[0]-e[0]}function s(){var t,e=this.stride,r=new Array(e.length);for(t=0;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+r+"_set("+l.join(",")+",v){"),i?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+l.join(",")+"){"),i?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",l.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+l.join(",")+"){return new "+r+"(this.data,"+o.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+o.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var d=o.map(function(t){return"a"+t+"=this.shape["+t+"]"}),p=o.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+l.join(",")+"){var b=this.offset,d=0,"+d.join(",")+","+p.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");a.push("return new "+r+"(this.data,"+o.map(function(t){return"a"+t}).join(",")+","+o.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+l.join(",")+"){var "+o.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+o.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(g=0;g=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+o.map(function(t){return"shape["+t+"]"}).join(",")+","+o.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(u[t],s)}var u={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=function(t,e,r,n){if(void 0===t)return(0,u.array[0])([]);"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var o=e.length;if(void 0===r){r=new Array(o);for(var s=o-1,c=1;s>=0;--s)r[s]=c,c*=e[s]}if(void 0===n)for(n=0,s=0;s>>0;e.exports=function(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return e<0?-i:i;var r=n.hi(t),o=n.lo(t);e>t==t>0?o===a?(r+=1,o=0):o+=1:0===o?(o=a,r-=1):o-=1;return n.pack(o,r)}},{"double-bits":83}],267:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa){var x=i[u],_=1/Math.sqrt(v*y);for(b=0;b<3;++b){var w=(b+1)%3,M=(b+2)%3;x[b]+=_*(m[w]*g[M]-m[M]*g[w])}}}for(o=0;oa)for(_=1/Math.sqrt(A),b=0;b<3;++b)x[b]*=_;else for(b=0;b<3;++b)x[b]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(d):0;for(u=0;u<3;++u)h[u]*=d;i[o]=h}return i}},{}],268:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(f>0){var f=Math.sqrt(c+1);t[0]=.5*(o-l)/f,t[1]=.5*(s-n)/f,t[2]=.5*(r-a)/f,t[3]=.5*f}else{var h=Math.max(e,a,u),f=Math.sqrt(2*h-c+1);e>=h?(t[0]=.5*f,t[1]=.5*(i+r)/f,t[2]=.5*(s+n)/f,t[3]=.5*(o-l)/f):a>=h?(t[0]=.5*(r+i)/f,t[1]=.5*f,t[2]=.5*(l+o)/f,t[3]=.5*(s-n)/f):(t[0]=.5*(n+s)/f,t[1]=.5*(o+l)/f,t[2]=.5*f,t[3]=.5*(r-i)/f)}return t}},{}],269:[function(t,e,r){"use strict";e.exports=function(t){var e=(t=t||{}).center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),c(r=[].slice.call(r,0,4),r);var i=new f(r,e,Math.log(n));i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up);return i};var n=t("filtered-vector"),i=t("gl-mat4/lookAt"),a=t("gl-mat4/fromQuat"),o=t("gl-mat4/invert"),s=t("./lib/quatFromFrame");function l(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function u(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function c(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=u(r,n,i,a);o>1e-6?(t[0]=r/o,t[1]=n/o,t[2]=i/o,t[3]=a/o):(t[0]=t[1]=t[2]=0,t[3]=1)}function f(t,e,r){this.radius=n([r]),this.center=n(e),this.rotation=n(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}var h=f.prototype;h.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},h.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;c(e,e);var r=this.computedMatrix;a(r,e);var n=this.computedCenter,i=this.computedEye,o=this.computedUp,s=Math.exp(this.computedRadius[0]);i[0]=n[0]+s*r[2],i[1]=n[1]+s*r[6],i[2]=n[2]+s*r[10],o[0]=r[1],o[1]=r[5],o[2]=r[9];for(var l=0;l<3;++l){for(var u=0,f=0;f<3;++f)u+=r[l+4*f]*i[f];r[12+l]=-u}},h.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r},h.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},h.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},h.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=i[1],o=i[5],s=i[9],u=l(a,o,s);a/=u,o/=u,s/=u;var c=i[0],f=i[4],h=i[8],d=c*a+f*o+h*s,p=l(c-=a*d,f-=o*d,h-=s*d);c/=p,f/=p,h/=p;var g=i[2],v=i[6],m=i[10],y=g*a+v*o+m*s,b=g*c+v*f+m*h,x=l(g-=y*a+b*c,v-=y*o+b*f,m-=y*s+b*h);g/=x,v/=x,m/=x;var _=c*e+a*r,w=f*e+o*r,M=h*e+s*r;this.center.move(t,_,w,M);var A=Math.exp(this.computedRadius[0]);A=Math.max(1e-4,A+n),this.radius.set(t,Math.log(A))},h.rotate=function(t,e,r,n){this.recalcMatrix(t),e=e||0,r=r||0;var i=this.computedMatrix,a=i[0],o=i[4],s=i[8],c=i[1],f=i[5],h=i[9],d=i[2],p=i[6],g=i[10],v=e*a+r*c,m=e*o+r*f,y=e*s+r*h,b=-(p*y-g*m),x=-(g*v-d*y),_=-(d*m-p*v),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),M=u(b,x,_,w);M>1e-6?(b/=M,x/=M,_/=M,w/=M):(b=x=_=0,w=1);var A=this.computedRotation,T=A[0],k=A[1],E=A[2],S=A[3],L=T*w+S*b+k*_-E*x,C=k*w+S*x+E*b-T*_,P=E*w+S*_+T*x-k*b,O=S*w-T*b-k*x-E*_;if(n){b=d,x=p,_=g;var R=Math.sin(n)/l(b,x,_);b*=R,x*=R,_*=R,O=O*(w=Math.cos(e))-(L=L*w+O*b+C*_-P*x)*b-(C=C*w+O*x+P*b-L*_)*x-(P=P*w+O*_+L*x-C*b)*_}var I=u(L,C,P,O);I>1e-6?(L/=I,C/=I,P/=I,O/=I):(L=C=P=0,O=1),this.rotation.set(t,L,C,P,O)},h.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var a=this.computedMatrix;i(a,e,r,n);var o=this.computedRotation;s(o,a[0],a[1],a[2],a[4],a[5],a[6],a[8],a[9],a[10]),c(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var l=0,u=0;u<3;++u)l+=Math.pow(r[u]-e[u],2);this.radius.set(t,.5*Math.log(Math.max(l,1e-6))),this.center.set(t,r[0],r[1],r[2])},h.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},h.setMatrix=function(t,e){var r=this.computedRotation;s(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),c(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;o(n,e);var i=n[15];if(Math.abs(i)>1e-6){var a=n[12]/i,l=n[13]/i,u=n[14]/i;this.recalcMatrix(t);var f=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*f,l-n[6]*f,u-n[10]*f),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},h.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},h.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-1/0,e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},h.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},h.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},h.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":268,"filtered-vector":91,"gl-mat4/fromQuat":121,"gl-mat4/invert":124,"gl-mat4/lookAt":125}],270:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return n(r=void 0!==r?r+"":" ",e)+t}},{"repeat-string":294}],271:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],272:[function(t,e,r){"use strict";e.exports=function(t){var e=t.length;if(e0;--o)a=l[o],r=s[o],s[o]=s[a],s[a]=r,l[o]=l[r],l[r]=a,u=(u+r)*o;return n.freeUint32(l),n.freeUint32(s),u},r.unrank=function(t,e,r){switch(t){case 0:return r||[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}var n,i,a,o=1;for((r=r||new Array(t))[0]=0,a=1;a0;--a)e=e-(n=e/o|0)*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}},{"invert-permutation":236,"typedarray-pool":328}],274:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=0|e.length,i=t.length,a=[new Array(r),new Array(r)],o=0;o0){o=a[c][r][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=a[f][r],d=0;d0&&(o=p,s=g,l=f)}return i?s:(o&&u(o,l),s)}function f(t,r){var i=a[r][t][0],o=[t];u(i,r);for(var s=i[1^r];;){for(;s!==t;)o.push(s),s=c(o[o.length-2],s,!1);if(a[0][t].length+a[1][t].length===0)break;var l=o[o.length-1],f=t,h=o[1],d=c(l,f,!0);if(n(e[l],e[f],e[h],e[d])<0)break;o.push(t),s=c(l,f)}return o}function h(t,e){return e[1]===e[e.length-1]}for(var o=0;o0;){a[0][o].length;var g=f(o,d);h(p,g)?p.push.apply(p,g):(p.length>0&&l.push(p),p=g)}p.length>0&&l.push(p)}return l};var n=t("compare-angle")},{"compare-angle":68}],275:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=n(t,e.length),i=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();i[u]=!1;for(var c=r[u],s=0;s0})).length,v=new Array(g),m=new Array(g),d=0;d0;){var j=D.pop(),B=L[j];l(B,function(t,e){return t-e});var U,V=B.length,H=F[j];if(0===H){var M=p[j];U=[M]}for(var d=0;d=0)&&(F[q]=1^H,D.push(q),0===H)){var M=p[q];z(M)||(M.reverse(),U.push(M))}}0===H&&r.push(U)}return r};var n=t("edges-to-adjacency-list"),i=t("planar-dual"),a=t("point-in-big-polygon"),o=t("two-product"),s=t("robust-sum"),l=t("uniq"),u=t("./lib/trim-leaves");function c(t,e){for(var r=new Array(t),n=0;n0&&e[i]===r[0]))return 1;a=t[i-1]}for(var s=1;a;){var l=a.key,u=n(r,l[0],l[1]);if(l[0][0]0))return 0;s=-1,a=a.right}else if(u>0)a=a.left;else{if(!(u<0))return 0;s=1,a=a.right}}return s}}(m.slabs,m.coordinates);return 0===a.length?y:function(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}(l(a),y)};var n=t("robust-orientation")[3],i=t("slab-decomposition"),a=t("interval-tree-1d"),o=t("binary-search-bounds");function s(){return!0}function l(t){for(var e={},r=0;r=-t},pointBetween:function(e,r,n){var i=e[1]-r[1],a=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*a+i*s;return!(l-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-i>t&&(a-u)*(i-c)/(o-c)+u-n>t&&(s=!s),a=u,o=c}return s}};return e}},{}],281:[function(t,e,r){var n={toPolygon:function(t,e){function r(e){if(e.length<=0)return t.segments({inverted:!1,regions:[]});function r(e){var r=e.slice(0,e.length-1);return t.segments({inverted:!1,regions:[r]})}for(var n=r(e[0]),i=1;i0})}function c(t,n){var i=t.seg,a=n.seg,o=i.start,s=i.end,u=a.start,c=a.end;r&&r.checkIntersection(i,a);var f=e.linesIntersect(o,s,u,c);if(!1===f){if(!e.pointsCollinear(o,s,u))return!1;if(e.pointsSame(o,c)||e.pointsSame(s,u))return!1;var h=e.pointsSame(o,u),d=e.pointsSame(s,c);if(h&&d)return n;var p=!h&&e.pointBetween(o,u,c),g=!d&&e.pointBetween(s,u,c);if(h)return g?l(n,s):l(t,c),n;p&&(d||(g?l(n,s):l(t,c)),l(n,o))}else 0===f.alongA&&(-1===f.alongB?l(t,u):0===f.alongB?l(t,f.pt):1===f.alongB&&l(t,c)),0===f.alongB&&(-1===f.alongA?l(n,o):0===f.alongA?l(n,f.pt):1===f.alongA&&l(n,s));return!1}for(var f=[];!a.isEmpty();){var h=a.getHead();if(r&&r.vert(h.pt[0]),h.isStart){r&&r.segmentNew(h.seg,h.primary);var d=u(h),p=d.before?d.before.ev:null,g=d.after?d.after.ev:null;function v(){if(p){var t=c(h,p);if(t)return t}return!!g&&c(h,g)}r&&r.tempStatus(h.seg,!!p&&p.seg,!!g&&g.seg);var m,y,b=v();if(b)t?(y=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(b.seg.myFill.above=!b.seg.myFill.above):b.seg.otherFill=h.seg.myFill,r&&r.segmentUpdate(b.seg),h.other.remove(),h.remove();if(a.getHead()!==h){r&&r.rewind(h.seg);continue}t?(y=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below,h.seg.myFill.below=g?g.seg.myFill.above:i,h.seg.myFill.above=y?!h.seg.myFill.below:h.seg.myFill.below):null===h.seg.otherFill&&(m=g?h.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:h.primary?o:i,h.seg.otherFill={above:m,below:m}),r&&r.status(h.seg,!!p&&p.seg,!!g&&g.seg),h.other.status=d.insert(n.node({ev:h}))}else{var x=h.status;if(null===x)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(s.exists(x.prev)&&s.exists(x.next)&&c(x.prev.ev,x.next.ev),r&&r.statusRemove(x.ev.seg),x.remove(),!h.primary){var _=h.seg.myFill;h.seg.myFill=h.seg.otherFill,h.seg.otherFill=_}f.push(h.seg)}a.getHead().remove()}return r&&r.done(),f}return t?{addRegion:function(t){for(var n,i,a,o=t[t.length-1],l=0;l=u?(A=1,y=u+2*h+p):y=h*(A=-h/u)+p):(A=0,d>=0?(T=0,y=p):-d>=f?(T=1,y=f+2*d+p):y=d*(T=-d/f)+p);else if(T<0)T=0,h>=0?(A=0,y=p):-h>=u?(A=1,y=u+2*h+p):y=h*(A=-h/u)+p;else{var k=1/M;y=(A*=k)*(u*A+c*(T*=k)+2*h)+T*(c*A+f*T+2*d)+p}else A<0?(x=f+d)>(b=c+h)?(_=x-b)>=(w=u-2*c+f)?(A=1,T=0,y=u+2*h+p):y=(A=_/w)*(u*A+c*(T=1-A)+2*h)+T*(c*A+f*T+2*d)+p:(A=0,x<=0?(T=1,y=f+2*d+p):d>=0?(T=0,y=p):y=d*(T=-d/f)+p):T<0?(x=u+h)>(b=c+d)?(_=x-b)>=(w=u-2*c+f)?(T=1,A=0,y=f+2*d+p):y=(A=1-(T=_/w))*(u*A+c*T+2*h)+T*(c*A+f*T+2*d)+p:(T=0,x<=0?(A=1,y=u+2*h+p):h>=0?(A=0,y=p):y=h*(A=-h/u)+p):(_=f+d-c-h)<=0?(A=0,T=1,y=f+2*d+p):_>=(w=u-2*c+f)?(A=1,T=0,y=u+2*h+p):y=(A=_/w)*(u*A+c*(T=1-A)+2*h)+T*(c*A+f*T+2*d)+p;var E=1-A-T;for(l=0;l1)for(var r=1;r0){var u=t[r-1];if(0===n(s,u)&&a(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}},{"cell-orientation":54,"compare-cell":69,"compare-oriented-cell":70}],294:[function(t,e,r){"use strict";var n,i="";e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("expected a string");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;if(n!==t||void 0===n)n=t,i="";else if(i.length>=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i=(i+=t).substr(0,r)}},{}],295:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],296:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i],s=(r=a+o)-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",t(e.slice(0,r)),",",t(e.slice(r)),")"].join("")}(e);var n}function c(t){return new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",u(function(t){for(var e=new Array(t),r=0;r>1;return["sum(",u(t.slice(0,e)),",",u(t.slice(e)),")"].join("")}function c(t,e){if("m"===t.charAt(0)){if("w"===e.charAt(0)){var r=t.split("[");return["w",e.substr(1),"m",r[0].substr(1)].join("")}return["prod(",t,",",e,")"].join("")}return c(e,t)}function f(t){if(2===t.length)return[["diff(",c(t[0][0],t[1][1]),",",c(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var o=0;o0&&r.push(","),o===i?r.push("+b[",a,"]"):r.push("+A[",a,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var s=new Function("det",r.join(""));return s(t<6?n[t]:n)}var o=[function(){return[0]},function(t,e){return[[e[0]],[t[0][0]]]}];!function(){for(;o.length>1;return["sum(",u(t.slice(0,e)),",",u(t.slice(e)),")"].join("")}function c(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;r0){if(a<=0)return o;n=i+a}else{if(!(i<0))return o;if(a>=0)return o;n=-(i+a)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:h(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],a=e[0]-n[0],o=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],p=a*u,g=o*l,v=o*s,m=i*u,y=i*l,b=a*s,x=c*(p-g)+f*(v-m)+h*(y-b),_=7.771561172376103e-16*((Math.abs(p)+Math.abs(g))*Math.abs(c)+(Math.abs(v)+Math.abs(m))*Math.abs(f)+(Math.abs(y)+Math.abs(b))*Math.abs(h));return x>_||-x>_?x:d(t,e,r,n)}];!function(){for(;p.length<=s;)p.push(f(p.length));for(var t=[],r=["slow"],n=0;n<=s;++n)t.push("a"+n),r.push("o"+n);var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(n=2;n<=s;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i0&&o>0||a<0&&o<0)return!1;var s=n(r,t,e),l=n(i,t,e);if(s>0&&l>0||s<0&&l<0)return!1;if(0===a&&0===o&&0===s&&0===l)return function(t,e,r,n){for(var i=0;i<2;++i){var a=t[i],o=e[i],s=Math.min(a,o),l=Math.max(a,o),u=r[i],c=n[i],f=Math.min(u,c),h=Math.max(u,c);if(h=n?(i=f,(l+=1)=n?(i=f,(l+=1)0?1:0}},{}],308:[function(t,e,r){"use strict";e.exports=function(t){return i(n(t))};var n=t("boundary-cells"),i=t("reduce-simplicial-complex")},{"boundary-cells":38,"reduce-simplicial-complex":293}],309:[function(t,e,r){"use strict";e.exports=function(t,e,r,s){r=r||0,void 0===s&&(s=function(t){for(var e=t.length,r=0,n=0;n>1,v=E[2*m+1];","if(v===b){return m}","if(b0&&l.push(","),l.push("[");for(var n=0;n0&&l.push(","),l.push("B(C,E,c[",i[0],"],c[",i[1],"])")}l.push("]")}l.push(");")}}for(var a=t+1;a>1;--a){a>1,s=a(t[o],e);s<=0?(0===s&&(i=o),r=o+1):s>0&&(n=o-1)}return i}function c(t,e){for(var r=new Array(t.length),i=0,o=r.length;i=t.length||0!==a(t[v],s)););}return r}function f(t,e){if(e<0)return[];for(var r=[],i=(1<>>c&1&&u.push(i[c]);e.push(u)}return s(e)},r.skeleton=f,r.boundary=function(t){for(var e=[],r=0,n=t.length;r>1:(t>>1)-1}function b(t){for(var e=m(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(n0;){var r=y(t);if(r>=0){var n=m(r);if(e0){var t=A[0];return v(0,E-1),E-=1,b(0),t}return-1}function w(t,e){var r=A[t];return u[r]===e?t:(u[r]=-1/0,x(t),_(),u[r]=e,x((E+=1)-1))}function M(t){if(!c[t]){c[t]=!0;var e=s[t],r=l[t];s[r]>=0&&(s[r]=e),l[e]>=0&&(l[e]=r),T[e]>=0&&w(T[e],g(e)),T[r]>=0&&w(T[r],g(r))}}for(var A=[],T=new Array(a),f=0;f>1;f>=0;--f)b(f);for(;;){var S=_();if(S<0||u[S]>r)break;M(S)}for(var L=[],f=0;f=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&P.push([n,i])}}),i.unique(i.normalize(P)),{positions:L,edges:P}};var n=t("robust-orientation"),i=t("simplicial-complex")},{"robust-orientation":301,"simplicial-complex":313}],316:[function(t,e,r){"use strict";e.exports=function(t,e){var r,a,o,s;if(e[0][0]e[1][0]))return i(e,t);r=e[1],a=e[0]}if(t[0][0]t[1][0]))return-i(t,e);o=t[1],s=t[0]}var l=n(r,a,s),u=n(r,a,o);if(l<0){if(u<=0)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=n(s,o,a),u=n(s,o,r),l<0){if(u<=0)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return a[0]-s[0]};var n=t("robust-orientation");function i(t,e){var r,i,a,o;if(e[0][0]e[1][0])){var s=Math.min(t[0][1],t[1][1]),l=Math.max(t[0][1],t[1][1]),u=Math.min(e[0][1],e[1][1]),c=Math.max(e[0][1],e[1][1]);return lc?s-c:l-c}r=e[1],i=e[0]}t[0][1]0)if(e[0]!==o[1][0])r=t,t=t.right;else{if(l=u(t.right,e))return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l;if(l=u(t.right,e))return l;t=t.left}}return r}function c(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function f(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}s.prototype.castUp=function(t){var e=n.le(this.coordinates,t[0]);if(e<0)return-1;this.slabs[e];var r=u(this.slabs[e],t),i=-1;if(r&&(i=r.value),this.coordinates[e]===t[0]){var s=null;if(r&&(s=r.key),e>0){var c=u(this.slabs[e-1],t);c&&(s?o(c.key,s)>0&&(s=c.key,i=c.value):(i=c.value,s=c.key))}var f=this.horizontal[e];if(f.length>0){var h=n.ge(f,t[1],l);if(h=f.length)return i;d=f[h]}}if(d.start)if(s){var p=a(s[0],s[1],[t[0],d.y]);s[0][0]>s[1][0]&&(p=-p),p>0&&(i=d.index)}else i=d.index;else d.y!==t[1]&&(i=d.index)}}}return i}},{"./lib/order-segments":316,"binary-search-bounds":35,"functional-red-black-tree":92,"robust-orientation":301}],318:[function(t,e,r){"use strict";var n=t("robust-dot-product"),i=t("robust-sum");function a(t,e){var r=i(n(t,e),[e[e.length-1]]);return r[r.length-1]}function o(t,e,r,n){var i=-e/(n-e);i<0?i=0:i>1&&(i=1);for(var a=1-i,o=t.length,s=new Array(o),l=0;l0||i>0&&c<0){var f=o(s,c,l,i);r.push(f),n.push(f.slice())}c<0?n.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),n.push(l.slice())),i=c}return{positive:r,negative:n}},e.exports.positive=function(t,e){for(var r=[],n=a(t[t.length-1],e),i=t[t.length-1],s=t[0],l=0;l0||n>0&&u<0)&&r.push(o(i,u,s,n)),u>=0&&r.push(s.slice()),n=u}return r},e.exports.negative=function(t,e){for(var r=[],n=a(t[t.length-1],e),i=t[t.length-1],s=t[0],l=0;l0||n>0&&u<0)&&r.push(o(i,u,s,n)),u<=0&&r.push(s.slice()),n=u}return r}},{"robust-dot-product":298,"robust-sum":306}],319:[function(t,e,r){!function(){"use strict";var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};function e(r){return function(r,n){var i,a,o,s,l,u,c,f,h,d=1,p=r.length,g="";for(a=0;a=0),s[8]){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,s[6]?parseInt(s[6]):0);break;case"e":i=s[7]?parseFloat(i).toExponential(s[7]):parseFloat(i).toExponential();break;case"f":i=s[7]?parseFloat(i).toFixed(s[7]):parseFloat(i);break;case"g":i=s[7]?String(Number(i.toPrecision(s[7]))):parseFloat(i);break;case"o":i=(parseInt(i,10)>>>0).toString(8);break;case"s":i=String(i),i=s[7]?i.substring(0,s[7]):i;break;case"t":i=String(!!i),i=s[7]?i.substring(0,s[7]):i;break;case"T":i=Object.prototype.toString.call(i).slice(8,-1).toLowerCase(),i=s[7]?i.substring(0,s[7]):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=s[7]?i.substring(0,s[7]):i;break;case"x":i=(parseInt(i,10)>>>0).toString(16);break;case"X":i=(parseInt(i,10)>>>0).toString(16).toUpperCase()}t.json.test(s[8])?g+=i:(!t.number.test(s[8])||f&&!s[3]?h="":(h=f?"+":"-",i=i.toString().replace(t.sign,"")),u=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",c=s[6]-(h+i).length,l=s[6]&&c>0?u.repeat(c):"",g+=s[5]?h+i+l:"0"===u?h+l+i:l+h+i)}return g}(function(e){if(i[e])return i[e];var r,n=e,a=[],o=0;for(;n;){if(null!==(r=t.text.exec(n)))a.push(r[0]);else if(null!==(r=t.modulo.exec(n)))a.push("%");else{if(null===(r=t.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){o|=1;var s=[],l=r[2],u=[];if(null===(u=t.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=t.key_access.exec(l)))s.push(u[1]);else{if(null===(u=t.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(u[1])}r[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");a.push(r)}n=n.substring(r[0].length)}return i[e]=a}(r),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}var i=Object.create(null);void 0!==r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],320:[function(t,e,r){"use strict";e.exports=function(t){return t.split("").map(function(t){return t in n?n[t]:""}).join("")};var n={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],321:[function(t,e,r){"use strict";e.exports=function(t,e){if(t.dimension<=0)return{positions:[],cells:[]};if(1===t.dimension)return function(t,e){for(var r=a(t,e),n=r.length,i=new Array(n),o=new Array(n),s=0;s c)|0 },"),"generic"===e&&a.push("getters:[0],");for(var s=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128==0){f.length>0&&h.push("}}");var d="vExtra"+f.length;a.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(T="+"+v[x]+"*c");var k=p[x].length/y*.5,E=.5+m[x]/y*.5;A.push("d"+x+"-"+E+"-"+k+"*("+p[x].join("+")+T+")/("+g[x].join("+")+")")}h.push("a.push([",A.join(),"]);","break;")}a.push("}},"),f.length>0&&h.push("}}");for(var S=[],u=0;u<1<1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=C(t,360),e=C(e,100),r=C(r,100),0===e)n=i=a=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;n=o(l,s,t+1/3),i=o(l,s,t),a=o(l,s,t-1/3)}return{r:255*n,g:255*i,b:255*a}}(e.h,l,c),f=!0,h="hsl"),e.hasOwnProperty("a")&&(a=e.a));var d,p,g;return a=L(a),{ok:f,format:e.format||h,r:o(255,s(i.r,0)),g:o(255,s(i.g,0)),b:o(255,s(i.b,0)),a:a}}(e);this._originalInput=e,this._r=c.r,this._g=c.g,this._b=c.b,this._a=c.a,this._roundA=a(100*this._a)/100,this._format=l.format||c.format,this._gradientType=l.gradientType,this._r<1&&(this._r=a(this._r)),this._g<1&&(this._g=a(this._g)),this._b<1&&(this._b=a(this._b)),this._ok=c.ok,this._tc_id=i++}function c(t,e,r){t=C(t,255),e=C(e,255),r=C(r,255);var n,i,a=s(t,e,r),l=o(t,e,r),u=(a+l)/2;if(a==l)n=i=0;else{var c=a-l;switch(i=u>.5?c/(2-a-l):c/(a+l),a){case t:n=(e-r)/c+(e>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(u(n));return a}function k(t,e){e=e||6;for(var r=u(t).toHsv(),n=r.h,i=r.s,a=r.v,o=[],s=1/e;e--;)o.push(u({h:n,s:i,v:a})),a=(a+s)%1;return o}u.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var e,r,n,i=this.toRgb();return e=i.r/255,r=i.g/255,n=i.b/255,.2126*(e<=.03928?e/12.92:t.pow((e+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:t.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:t.pow((n+.055)/1.055,2.4))},setAlpha:function(t){return this._a=L(t),this._roundA=a(100*this._a)/100,this},toHsv:function(){var t=f(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=f(this._r,this._g,this._b),e=a(360*t.h),r=a(100*t.s),n=a(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=c(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=c(this._r,this._g,this._b),e=a(360*t.h),r=a(100*t.s),n=a(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return h(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,n,i){var o=[R(a(t).toString(16)),R(a(e).toString(16)),R(a(r).toString(16)),R(N(n))];if(i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:a(this._r),g:a(this._g),b:a(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+a(this._r)+", "+a(this._g)+", "+a(this._b)+")":"rgba("+a(this._r)+", "+a(this._g)+", "+a(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:a(100*C(this._r,255))+"%",g:a(100*C(this._g,255))+"%",b:a(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*C(this._r,255))+"%, "+a(100*C(this._g,255))+"%, "+a(100*C(this._b,255))+"%)":"rgba("+a(100*C(this._r,255))+"%, "+a(100*C(this._g,255))+"%, "+a(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=u(t);r="#"+d(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return u(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(T,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(M,arguments)}},u.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:I(t[n]));t=r}return u(t,e)},u.equals=function(t,e){return!(!t||!e)&&u(t).toRgbString()==u(e).toRgbString()},u.random=function(){return u.fromRatio({r:l(),g:l(),b:l()})},u.mix=function(t,e,r){r=0===r?0:r||50;var n=u(t).toRgb(),i=u(e).toRgb(),a=r/100;return u({r:(i.r-n.r)*a+n.r,g:(i.g-n.g)*a+n.g,b:(i.b-n.b)*a+n.b,a:(i.a-n.a)*a+n.a})},u.readability=function(e,r){var n=u(e),i=u(r);return(t.max(n.getLuminance(),i.getLuminance())+.05)/(t.min(n.getLuminance(),i.getLuminance())+.05)},u.isReadable=function(t,e,r){var n,i,a=u.readability(t,e);switch(i=!1,(n=function(t){var e,r;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==r&&"large"!==r&&(r="small");return{level:e,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":i=a>=4.5;break;case"AAlarge":i=a>=3;break;case"AAAsmall":i=a>=7}return i},u.mostReadable=function(t,e,r){var n,i,a,o,s=null,l=0;i=(r=r||{}).includeFallbackColors,a=r.level,o=r.size;for(var c=0;cl&&(l=n,s=u(e[c]));return u.isReadable(t,s,{level:a,size:o})||!i?s:(r.includeFallbackColors=!1,u.mostReadable(t,["#fff","#000"],r))};var E=u.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},S=u.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(E);function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(e,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(e)&&(e="100%");var n=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(e);return e=o(r,s(0,parseFloat(e))),n&&(e=parseInt(e*r,10)/100),t.abs(e-r)<1e-6?1:e%r/parseFloat(r)}function P(t){return o(1,s(0,t))}function O(t){return parseInt(t,16)}function R(t){return 1==t.length?"0"+t:""+t}function I(t){return t<=1&&(t=100*t+"%"),t}function N(e){return t.round(255*parseFloat(e)).toString(16)}function z(t){return O(t)/255}var D,F,j,B=(F="[\\s|\\(]+("+(D="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",j="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",{CSS_UNIT:new RegExp(D),rgb:new RegExp("rgb"+F),rgba:new RegExp("rgba"+j),hsl:new RegExp("hsl"+F),hsla:new RegExp("hsla"+j),hsv:new RegExp("hsv"+F),hsva:new RegExp("hsva"+j),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function U(t){return!!B.CSS_UNIT.exec(t)}void 0!==e&&e.exports?e.exports=u:window.tinycolor=u}(Math)},{}],323:[function(t,e,r){"use strict";var n=t("parse-unit");e.exports=o;var i=96;function a(t,e){var r=n(getComputedStyle(t).getPropertyValue(e));return r[0]*o(r[1],t)}function o(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return function(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var n=a(r,"font-size")/128;return e.removeChild(r),n}(t,e);case"em":return a(e,"font-size");case"rem":return a(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return i;case"cm":return i/2.54;case"mm":return i/25.4;case"pt":return i/72;case"pc":return i/6}return 1}},{"parse-unit":271}],324:[function(t,e,r){"use strict";e.exports=function(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(a(t+1)),r=[],o=0;oMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,l=0;l<3;++l)a+=t[l]*t[l],o+=i[l]*t[l];for(l=0;l<3;++l)i[l]-=o/a*t[l];return s(i,i),i}function h(t,e,r,i,a,o,s,l){this.center=n(r),this.up=n(i),this.right=n(a),this.radius=n([o]),this.angle=n([s,l]),this.angle.bounds=[[-1/0,-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}var d=h.prototype;d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-1/0,e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,n=0,i=0,a=0;a<3;++a)i+=e[a]*r[a],n+=e[a]*e[a];var l=Math.sqrt(n),c=0;for(a=0;a<3;++a)r[a]-=e[a]*i/n,c+=r[a]*r[a],e[a]/=l;var f=Math.sqrt(c);for(a=0;a<3;++a)r[a]/=f;var h=this.computedToward;o(h,e,r),s(h,h);var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],v=Math.cos(p),m=Math.sin(p),y=Math.cos(g),b=Math.sin(g),x=this.computedCenter,_=v*y,w=m*y,M=b,A=-v*b,T=-m*b,k=y,E=this.computedEye,S=this.computedMatrix;for(a=0;a<3;++a){var L=_*r[a]+w*h[a]+M*e[a];S[4*a+1]=A*r[a]+T*h[a]+k*e[a],S[4*a+2]=L,S[4*a+3]=0}var C=S[1],P=S[5],O=S[9],R=S[2],I=S[6],N=S[10],z=P*N-O*I,D=O*R-C*N,F=C*I-P*R,j=u(z,D,F);z/=j,D/=j,F/=j,S[0]=z,S[4]=D,S[8]=F;for(a=0;a<3;++a)E[a]=x[a]+S[2+4*a]*d;for(a=0;a<3;++a){c=0;for(var B=0;B<3;++B)c+=S[a+4*B]*E[B];S[12+a]=-c}S[15]=1},d.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r};var p=[0,0,0];d.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;p[0]=i[2],p[1]=i[6],p[2]=i[10];for(var o=this.computedUp,s=this.computedRight,l=this.computedToward,u=0;u<3;++u)i[4*u]=o[u],i[4*u+1]=s[u],i[4*u+2]=l[u];a(i,i,n,p);for(u=0;u<3;++u)o[u]=i[4*u],s[u]=i[4*u+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,s[0],s[1],s[2])}},d.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=(Math.exp(this.computedRadius[0]),i[1]),o=i[5],s=i[9],l=u(a,o,s);a/=l,o/=l,s/=l;var c=i[0],f=i[4],h=i[8],d=c*a+f*o+h*s,p=u(c-=a*d,f-=o*d,h-=s*d),g=(c/=p)*e+a*r,v=(f/=p)*e+o*r,m=(h/=p)*e+s*r;this.center.move(t,g,v,m);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+n),this.radius.set(t,Math.log(y))},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e,r,n){var a=1;"number"==typeof r&&(a=0|r),(a<0||a>3)&&(a=1);var o=(a+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var s=e[a],l=e[a+4],f=e[a+8];if(n){var h=Math.abs(s),d=Math.abs(l),p=Math.abs(f),g=Math.max(h,d,p);h===g?(s=s<0?-1:1,l=f=0):p===g?(f=f<0?-1:1,s=l=0):(l=l<0?-1:1,s=f=0)}else{var v=u(s,l,f);s/=v,l/=v,f/=v}var m,y,b=e[o],x=e[o+4],_=e[o+8],w=b*s+x*l+_*f,M=u(b-=s*w,x-=l*w,_-=f*w),A=l*(_/=M)-f*(x/=M),T=f*(b/=M)-s*_,k=s*x-l*b,E=u(A,T,k);if(A/=E,T/=E,k/=E,this.center.jump(t,q,G,X),this.radius.idle(t),this.up.jump(t,s,l,f),this.right.jump(t,b,x,_),2===a){var S=e[1],L=e[5],C=e[9],P=S*b+L*x+C*_,O=S*A+L*T+C*k;m=z<0?-Math.PI/2:Math.PI/2,y=Math.atan2(O,P)}else{var R=e[2],I=e[6],N=e[10],z=R*s+I*l+N*f,D=R*b+I*x+N*_,F=R*A+I*T+N*k;m=Math.asin(c(z)),y=Math.atan2(F,D)}this.angle.jump(t,y,m),this.recalcMatrix(t);var j=e[2],B=e[6],U=e[10],V=this.computedMatrix;i(V,e);var H=V[15],q=V[12]/H,G=V[13]/H,X=V[14]/H,W=Math.exp(this.computedRadius[0]);this.center.jump(t,q-j*W,G-B*W,X-U*W)},d.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},d.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},d.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter;var i=(n=n||this.computedUp)[0],a=n[1],o=n[2],s=u(i,a,o);if(!(s<1e-6)){i/=s,a/=s,o/=s;var l=e[0]-r[0],f=e[1]-r[1],h=e[2]-r[2],d=u(l,f,h);if(!(d<1e-6)){l/=d,f/=d,h/=d;var p=this.computedRight,g=p[0],v=p[1],m=p[2],y=i*g+a*v+o*m,b=u(g-=y*i,v-=y*a,m-=y*o);if(!(b<.01&&(b=u(g=a*h-o*f,v=o*l-i*h,m=i*f-a*l))<1e-6)){g/=b,v/=b,m/=b,this.up.set(t,i,a,o),this.right.set(t,g,v,m),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=a*m-o*v,_=o*g-i*m,w=i*v-a*g,M=u(x,_,w),A=i*l+a*f+o*h,T=g*l+v*f+m*h,k=(x/=M)*l+(_/=M)*f+(w/=M)*h,E=Math.asin(c(A)),S=Math.atan2(k,T),L=this.angle._state,C=L[L.length-1],P=L[L.length-2];C%=2*Math.PI;var O=Math.abs(C+2*Math.PI-S),R=Math.abs(C-S),I=Math.abs(C-2*Math.PI-S);O0?r.pop():new ArrayBuffer(t)}function h(t){return new Uint8Array(f(t),0,t)}function d(t){return new Uint16Array(f(2*t),0,t)}function p(t){return new Uint32Array(f(4*t),0,t)}function g(t){return new Int8Array(f(t),0,t)}function v(t){return new Int16Array(f(2*t),0,t)}function m(t){return new Int32Array(f(4*t),0,t)}function y(t){return new Float32Array(f(4*t),0,t)}function b(t){return new Float64Array(f(8*t),0,t)}function x(t){return o?new Uint8ClampedArray(f(t),0,t):h(t)}function _(t){return new DataView(f(t),0,t)}function w(t){t=i.nextPow2(t);var e=i.log2(t),r=u[e];return r.length>0?r.pop():new n(t)}r.free=function(t){if(n.isBuffer(t))u[i.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|i.log2(e);l[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){c(t.buffer)},r.freeArrayBuffer=c,r.freeBuffer=function(t){u[i.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return f(t);switch(e){case"uint8":return h(t);case"uint16":return d(t);case"uint32":return p(t);case"int8":return g(t);case"int16":return v(t);case"int32":return m(t);case"float":case"float32":return y(t);case"double":case"float64":return b(t);case"uint8_clamped":return x(t);case"buffer":return w(t);case"data":case"dataview":return _(t);default:return null}return null},r.mallocArrayBuffer=f,r.mallocUint8=h,r.mallocUint16=d,r.mallocUint32=p,r.mallocInt8=g,r.mallocInt16=v,r.mallocInt32=m,r.mallocFloat32=r.mallocFloat=y,r.mallocFloat64=r.mallocDouble=b,r.mallocUint8Clamped=x,r.mallocDataView=_,r.mallocBuffer=w,r.clearCache=function(){for(var t=0;t<32;++t)s.UINT8[t].length=0,s.UINT16[t].length=0,s.UINT32[t].length=0,s.INT8[t].length=0,s.INT16[t].length=0,s.INT32[t].length=0,s.FLOAT[t].length=0,s.DOUBLE[t].length=0,s.UINT8C[t].length=0,l[t].length=0,u[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":36,buffer:47,dup:85}],329:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;e8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var o=3*n;t.height=0?e[a]:i})},has___:{value:b(function(e){var n=y(e);return n?r in n:t.indexOf(e)>=0})},set___:{value:b(function(n,i){var a,o=y(n);return o?o[r]=i:(a=t.indexOf(n))>=0?e[a]=i:(a=t.length,e[a]=i,t[a]=n),this})},delete___:{value:b(function(n){var i,a,o=y(n);return o?r in o&&delete o[r]:!((i=t.indexOf(n))<0||(a=t.length-1,t[i]=void 0,e[i]=e[a],t[i]=t[a],t.length=a,e.length=a,0))})}})};g.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof r?function(){function n(){this instanceof g||x();var e,n=new r,i=void 0,a=!1;return e=t?function(t,e){return n.set(t,e),n.has(t)||(i||(i=new g),i.set(t,e)),this}:function(t,e){if(a)try{n.set(t,e)}catch(r){i||(i=new g),i.set___(t,e)}else n.set(t,e);return this},Object.create(g.prototype,{get___:{value:b(function(t,e){return i?n.has(t)?n.get(t):i.get___(t,e):n.get(t,e)})},has___:{value:b(function(t){return n.has(t)||!!i&&i.has___(t)})},set___:{value:b(e)},delete___:{value:b(function(t){var e=!!n.delete(t);return i&&i.delete___(t)||e})},permitHostObjects___:{value:b(function(t){if(t!==v)throw new Error("bogus call to permitHostObjects___");a=!0})}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=g.prototype,e.exports=n,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=g)}function v(t){t.permitHostObjects___&&t.permitHostObjects___(v)}function m(t){return!(t.substr(0,l.length)==l&&"___"===t.substr(t.length-3))}function y(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[u];if(e&&e.key===t)return e;if(s(t)){e={key:t};try{return o(t,u,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function b(t){return t.prototype=null,Object.freeze(t)}function x(){d||"undefined"==typeof console||(d=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},{}],334:[function(t,e,r){var n=t("./hidden-store.js");e.exports=function(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:n(e,t)}}},{"./hidden-store.js":335}],335:[function(t,e,r){e.exports=function(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}},{}],336:[function(t,e,r){var n=t("./create-store.js");e.exports=function(){var t=n();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){return t(e).value=r,this},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}},{"./create-store.js":334}],337:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":94}],338:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array",{offset:[1],array:0},"scalar","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\n var _inline_1_da = _inline_1_arg0_ - _inline_1_arg3_\n var _inline_1_db = _inline_1_arg1_ - _inline_1_arg3_\n if((_inline_1_da >= 0) !== (_inline_1_db >= 0)) {\n _inline_1_arg2_.push(_inline_1_arg4_[0] + 0.5 + 0.5 * (_inline_1_da + _inline_1_db) / (_inline_1_da - _inline_1_db))\n }\n }",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg3_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:["_inline_1_da","_inline_1_db"]},funcName:"zeroCrossings"})},{"cwise-compiler":76}],339:[function(t,e,r){"use strict";e.exports=function(t,e){var r=[];return e=+e||0,n(t.hi(t.shape[0]-1),r,e),r};var n=t("./lib/zc-core")},{"./lib/zc-core":338}],340:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./common_defaults"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{};var c=u("visible",!(l=l||{}).itemIsNotPlainObject),f=u("clicktoshow");if(!c&&!f)return e;a(t,e,r,u);for(var h=e.showarrow,d=["x","y"],p=[-10,-30],g={_fullLayout:r},v=0;v<2;v++){var m=d[v],y=i.coerceRef(t,e,g,m,"","paper");if(i.coercePosition(e,g,u,y,m,.5),h){var b="a"+m,x=i.coerceRef(t,e,g,b,"pixel");"pixel"!==x&&x!==y&&(x=e[b]="pixel");var _="pixel"===x?p[v]:.4;i.coercePosition(e,g,u,x,b,_)}u(m+"anchor"),u(m+"shift")}if(n.noneOrAll(t,e,["x","y"]),h&&n.noneOrAll(t,e,["ax","ay"]),f){var w=u("xclick"),M=u("yclick");e._xclick=void 0===w?e.x:i.cleanPosition(w,g,e.xref),e._yclick=void 0===M?e.y:i.cleanPosition(M,g,e.yref)}return e}},{"../../lib":481,"../../plots/cartesian/axes":525,"./attributes":342,"./common_defaults":345}],341:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0,noRotate:!0},{path:"M2,2V-2H-2V2Z",backoff:0,noRotate:!0}]},{}],342:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0,editType:"calcIfAutorange+arraydraw"},text:{valType:"string",editType:"calcIfAutorange+arraydraw"},textangle:{valType:"angle",dflt:0,editType:"calcIfAutorange+arraydraw"},font:i({editType:"calcIfAutorange+arraydraw",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calcIfAutorange+arraydraw"},height:{valType:"number",min:1,dflt:null,editType:"calcIfAutorange+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calcIfAutorange+arraydraw"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calcIfAutorange+arraydraw"},showarrow:{valType:"boolean",dflt:!0,editType:"calcIfAutorange+arraydraw"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calcIfAutorange+arraydraw"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calcIfAutorange+arraydraw"},arrowwidth:{valType:"number",min:.1,editType:"calcIfAutorange+arraydraw"},standoff:{valType:"number",min:0,dflt:0,editType:"calcIfAutorange+arraydraw"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calcIfAutorange+arraydraw"},ax:{valType:"any",editType:"calcIfAutorange+arraydraw"},ay:{valType:"any",editType:"calcIfAutorange+arraydraw"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calcIfAutorange+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calcIfAutorange+arraydraw"},xshift:{valType:"number",dflt:0,editType:"calcIfAutorange+arraydraw"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calcIfAutorange+arraydraw"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calcIfAutorange+arraydraw"},yshift:{valType:"number",dflt:0,editType:"calcIfAutorange+arraydraw"},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:i({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}}},{"../../plots/cartesian/constants":530,"../../plots/font_attributes":551,"./arrow_paths":341}],343:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./draw").draw;function o(t){var e=t._fullLayout;n.filterVisible(e.annotations).forEach(function(e){var r,n,a,o,s=i.getFromId(t,e.xref),l=i.getFromId(t,e.yref),u=3*e.arrowsize*e.arrowwidth||0,c=3*e.startarrowsize*e.arrowwidth||0;s&&s.autorange&&(r=u+e.xshift,n=u-e.xshift,a=c+e.xshift,o=c-e.xshift,e.axref===e.xref?(i.expand(s,[s.r2c(e.x)],{ppadplus:r,ppadminus:n}),i.expand(s,[s.r2c(e.ax)],{ppadplus:Math.max(e._xpadplus,a),ppadminus:Math.max(e._xpadminus,o)})):(a=e.ax?a+e.ax:a,o=e.ax?o-e.ax:o,i.expand(s,[s.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r,a),ppadminus:Math.max(e._xpadminus,n,o)}))),l&&l.autorange&&(r=u-e.yshift,n=u+e.yshift,a=c-e.yshift,o=c+e.yshift,e.ayref===e.yref?(i.expand(l,[l.r2c(e.y)],{ppadplus:r,ppadminus:n}),i.expand(l,[l.r2c(e.ay)],{ppadplus:Math.max(e._ypadplus,a),ppadminus:Math.max(e._ypadminus,o)})):(a=e.ay?a+e.ay:a,o=e.ay?o-e.ay:o,i.expand(l,[l.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r,a),ppadminus:Math.max(e._ypadminus,n,o)})))})}e.exports=function(t){var e=t._fullLayout,r=n.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};for(var l in r.forEach(function(t){s[t.xref]=1,s[t.yref]=1}),s){var u=i.getFromId(t,l);if(u&&u.autorange)return n.syncOrAsync([a,o],t)}}}},{"../../lib":481,"../../plots/cartesian/axes":525,"./draw":348}],344:[function(t,e,r){"use strict";var n=t("../../registry");function i(t,e){var r,n,i,o,s,l,u,c=t._fullLayout.annotations,f=[],h=[],d=[],p=(e||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(t,e){var r,a=i(t,e),o=a.on,s=a.off.concat(a.explicitOff),l={};if(!o.length&&!s.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}e._w=N,e._h=D;for(var U=!1,V=["x","y"],H=0;H1)&&(J===Q?((ot=K.r2fraction(e["a"+Z]))<0||ot>1)&&(U=!0):U=!0,U))continue;q=K._offset+K.r2p(e[Z]),W=.5}else"x"===Z?(X=e[Z],q=b.l+b.w*X):(X=1-e[Z],q=b.t+b.h*X),W=e.showarrow?.5:X;if(e.showarrow){at.head=q;var st=e["a"+Z];Y=tt*B(.5,e.xanchor)-et*B(.5,e.yanchor),J===Q?(at.tail=K._offset+K.r2p(st),G=Y):(at.tail=q+st,G=Y+st),at.text=at.tail+Y;var lt=y["x"===Z?"width":"height"];if("paper"===Q&&(at.head=o.constrain(at.head,1,lt-1)),"pixel"===J){var ut=-Math.max(at.tail-3,at.text),ct=Math.min(at.tail+3,at.text)-lt;ut>0?(at.tail+=ut,at.text+=ut):ct>0&&(at.tail-=ct,at.text-=ct)}at.tail+=it,at.head+=it}else G=Y=rt*B(W,nt),at.text=q+Y;at.text+=it,Y+=it,G+=it,e["_"+Z+"padplus"]=rt/2+G,e["_"+Z+"padminus"]=rt/2-G,e["_"+Z+"size"]=rt,e["_"+Z+"shift"]=Y}if(U)S.remove();else{var ft=0,ht=0;if("left"!==e.align&&(ft=(N-E)*("center"===e.align?.5:1)),"top"!==e.valign&&(ht=(D-C)*("middle"===e.valign?.5:1)),c)n.select("svg").attr({x:P+ft-1,y:P+ht}).call(u.setClipUrl,R?_:null);else{var dt=P+ht-v.top,pt=P+ft-v.left;z.call(f.positionText,pt,dt).call(u.setClipUrl,R?_:null)}I.select("rect").call(u.setRect,P,P,N,D),O.call(u.setRect,L/2,L/2,F-L,j-L),S.call(u.setTranslate,Math.round(w.x.text-F/2),Math.round(w.y.text-j/2)),T.attr({transform:"rotate("+M+","+w.x.text+","+w.y.text+")"});var gt,vt,mt=function(r,n){A.selectAll(".annotation-arrow-g").remove();var c=w.x.head,f=w.y.head,h=w.x.tail+r,v=w.y.tail+n,y=w.x.text+r,_=w.y.text+n,k=o.rotationXYMatrix(M,y,_),E=o.apply2DTransform(k),L=o.apply2DTransform2(k),C=+O.attr("width"),P=+O.attr("height"),R=y-.5*C,I=R+C,N=_-.5*P,z=N+P,D=[[R,N,R,z],[R,z,I,z],[I,z,I,N],[I,N,R,N]].map(L);if(!D.reduce(function(t,e){return t^!!o.segmentsIntersect(c,f,c+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){D.forEach(function(t){var e=o.segmentsIntersect(h,v,c,f,t[0],t[1],t[2],t[3]);e&&(h=e.x,v=e.y)});var F=e.arrowwidth,j=e.arrowcolor,B=e.arrowside,U=A.append("g").style({opacity:l.opacity(j)}).classed("annotation-arrow-g",!0),V=U.append("path").attr("d","M"+h+","+v+"L"+c+","+f).style("stroke-width",F+"px").call(l.stroke,l.rgb(j));if(p(V,B,e),x.annotationPosition&&V.node().parentNode&&!a){var H=c,q=f;if(e.standoff){var G=Math.sqrt(Math.pow(c-h,2)+Math.pow(f-v,2));H+=e.standoff*(h-c)/G,q+=e.standoff*(v-f)/G}var X,W,Y,Z=U.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(h-H)+","+(v-q),transform:"translate("+H+","+q+")"}).style("stroke-width",F+6+"px").call(l.stroke,"rgba(0,0,0,0)").call(l.fill,"rgba(0,0,0,0)");d.init({element:Z.node(),gd:t,prepFn:function(){var t=u.getTranslate(S);W=t.x,Y=t.y,X={},s&&s.autorange&&(X[s._name+".autorange"]=!0),g&&g.autorange&&(X[g._name+".autorange"]=!0)},moveFn:function(t,r){var n=E(W,Y),i=n[0]+t,a=n[1]+r;S.call(u.setTranslate,i,a),X[m+".x"]=s?s.p2r(s.r2p(e.x)+t):e.x+t/b.w,X[m+".y"]=g?g.p2r(g.r2p(e.y)+r):e.y-r/b.h,e.axref===e.xref&&(X[m+".ax"]=s.p2r(s.r2p(e.ax)+t)),e.ayref===e.yref&&(X[m+".ay"]=g.p2r(g.r2p(e.ay)+r)),U.attr("transform","translate("+t+","+r+")"),T.attr({transform:"rotate("+M+","+i+","+a+")"})},doneFn:function(){i.call("relayout",t,X);var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&mt(0,0),k)d.init({element:S.node(),gd:t,prepFn:function(){vt=T.attr("transform"),gt={}},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?gt[m+".ax"]=s.p2r(s.r2p(e.ax)+t):gt[m+".ax"]=e.ax+t,e.ayref===e.yref?gt[m+".ay"]=g.p2r(g.r2p(e.ay)+r):gt[m+".ay"]=e.ay+r,mt(t,r);else{if(a)return;if(s)gt[m+".x"]=s.p2r(s.r2p(e.x)+t);else{var i=e._xsize/b.w,o=e.x+(e._xshift-e.xshift)/b.w-i/2;gt[m+".x"]=d.align(o+t/b.w,i,0,1,e.xanchor)}if(g)gt[m+".y"]=g.p2r(g.r2p(e.y)+r);else{var l=e._ysize/b.h,u=e.y-(e._yshift+e.yshift)/b.h-l/2;gt[m+".y"]=d.align(u-r/b.h,l,0,1,e.yanchor)}s&&g||(n=d.getCursor(s?.5:gt[m+".x"],g?.5:gt[m+".y"],e.xanchor,e.yanchor))}T.attr({transform:"translate("+t+","+r+")"+vt}),h(S,n)},doneFn:function(){h(S),i.call("relayout",t,gt);var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}}e.exports={draw:function(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,v=e.indexOf("end")>=0,m=f.backoff*d+r.standoff,y=h.backoff*p+r.startstandoff;if("line"===c.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},s={x:+t.attr("x2"),y:+t.attr("y2")};var b=o.x-s.x,x=o.y-s.y;if(u=(l=Math.atan2(x,b))+Math.PI,m&&y&&m+y>Math.sqrt(b*b+x*x))return void P();if(m){if(m*m>b*b+x*x)return void P();var _=m*Math.cos(l),w=m*Math.sin(l);s.x+=_,s.y+=w,t.attr({x2:s.x,y2:s.y})}if(y){if(y*y>b*b+x*x)return void P();var M=y*Math.cos(l),A=y*Math.sin(l);o.x-=M,o.y-=A,t.attr({x1:o.x,y1:o.y})}}else if("path"===c.nodeName){var T=c.getTotalLength(),k="";if(T1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l._pdata=i(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*r[0],e.yaxis.r2l(l.y)*r[1],e.zaxis.r2l(l.z)*r[2]]),n(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":564,"../annotations/draw":348}],355:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib");e.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:t("./attributes")}}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),includeBasePlot:function(t,e){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var a=r.attrRegex,o=Object.keys(t),s=0;s=0))return t;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return a?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}a.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},a.rgb=function(t){return a.tinyRGB(n(t))},a.opacity=function(t){return t?n(t).getAlpha():0},a.addOpacity=function(t,e){var r=n(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},a.combine=function(t,e){var r=n(t).toRgb();if(1===r.a)return n(t).toRgbString();var i=n(e||l).toRgb(),a=1===i.a?i:{r:255*(1-i.a)+i.r*i.a,g:255*(1-i.a)+i.g*i.a,b:255*(1-i.a)+i.b*i.a},o={r:a.r*(1-r.a)+r.r*r.a,g:a.g*(1-r.a)+r.g*r.a,b:a.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},a.contrast=function(t,e,r){var i=n(t);return 1!==i.getAlpha()&&(i=n(a.combine(t,l))),(i.isDark()?e?i.lighten(e):l:r?i.darken(r):s).toString()},a.stroke=function(t,e){var r=n(e);t.style({stroke:a.tinyRGB(r),"stroke-opacity":r.getAlpha()})},a.fill=function(t,e){var r=n(e);t.style({fill:a.tinyRGB(r),"fill-opacity":r.getAlpha()})},a.clean=function(t){if(t&&"object"==typeof t){var e,r,n,i,o=Object.keys(t);for(e=0;e0?T>=O:T<=O));k++)T>I&&T0?T>=O:T<=O));k++)T>E[0]&&T1){var nt=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));tt*=nt*u.roundUp(rt/nt,[2,5,10]),(Math.abs(r.levels.start)/r.levels.size+1e-6)%1<2e-6&&(K.tick0=0)}K.dtick=tt}K.domain=[Y+G,Y+V-G],K.setScale();var it=u.ensureSingle(x._infolayer,"g",e,function(t){t.classed(_.colorbar,!0).each(function(){var t=n.select(this);t.append("rect").classed(_.cbbg,!0),t.append("g").classed(_.cbfills,!0),t.append("g").classed(_.cblines,!0),t.append("g").classed(_.cbaxis,!0).classed(_.crisp,!0),t.append("g").classed(_.cbtitleunshift,!0).append("g").classed(_.cbtitle,!0),t.append("rect").classed(_.cboutline,!0),t.select(".cbtitle").datum(0)})});it.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var at=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")");K._axislayer=it.select(".cbaxis");var ot=0;if(-1!==["top","bottom"].indexOf(r.titleside)){var st,lt=A.l+(r.x+H)*A.w,ut=K.titlefont.size;st="top"===r.titleside?(1-(Y+V-G))*A.h+A.t+3+.75*ut:(1-(Y+G))*A.h+A.t-3-.25*ut,gt(K._id+"title",{attributes:{x:lt,y:st,"text-anchor":"start"}})}var ct,ft,ht,dt=u.syncOrAsync([a.previousPromises,function(){if(-1!==["top","bottom"].indexOf(r.titleside)){var e=it.select(".cbtitle"),a=e.select("text"),o=[-r.outlinewidth/2,r.outlinewidth/2],l=e.select(".h"+K._id+"title-math-group").node(),c=15.6;if(a.node()&&(c=parseInt(a.node().style.fontSize,10)*v),l?(ot=h.bBox(l).height)>c&&(o[1]-=(ot-c)/2):a.node()&&!a.classed(_.jsPlaceholder)&&(ot=h.bBox(a.node()).height),ot){if(ot+=5,"top"===r.titleside)K.domain[1]-=ot/A.h,o[1]*=-1;else{K.domain[0]+=ot/A.h;var f=g.lineCount(a);o[1]+=(1-f)*c}e.attr("transform","translate("+o+")"),K.setScale()}}it.selectAll(".cbfills,.cblines").attr("transform","translate(0,"+Math.round(A.h*(1-K.domain[1]))+")"),K._axislayer.attr("transform","translate(0,"+Math.round(-A.t)+")");var d=it.select(".cbfills").selectAll("rect.cbfill").data(L);d.enter().append("rect").classed(_.cbfill,!0).style("stroke","none"),d.exit().remove(),d.each(function(t,e){var r=[0===e?E[0]:(L[e]+L[e-1])/2,e===L.length-1?E[1]:(L[e]+L[e+1])/2].map(K.c2p).map(Math.round);e!==L.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=P(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:X,width:Math.max(j,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var p=it.select(".cblines").selectAll("path.cbline").data(r.line.color&&r.line.width?S:[]);return p.enter().append("path").classed(_.cbline,!0),p.exit().remove(),p.each(function(t){n.select(this).attr("d","M"+X+","+(Math.round(K.c2p(t))+r.line.width/2%1)+"h"+j).call(h.lineGroupStyle,r.line.width,C(t),r.line.dash)}),K._axislayer.selectAll("g."+K._id+"tick,path").remove(),K._pos=X+j+(r.outlinewidth||0)/2-("outside"===r.ticks?1:0),K.side="right",u.syncOrAsync([function(){return s.doTicksSingle(t,K,!0)},function(){if(-1===["top","bottom"].indexOf(r.titleside)){var e=K.titlefont.size,i=K._offset+K._length/2,a=A.l+(K.position||0)*A.w+("right"===K.side?10+e*(K.showticklabels?1:.5):-10-e*(K.showticklabels?.5:0));gt("h"+K._id+"title",{avoid:{selection:n.select(t).selectAll("g."+K._id+"tick"),side:r.titleside,offsetLeft:A.l,offsetTop:0,maxShift:x.width},attributes:{x:a,y:i,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])},a.previousPromises,function(){var n=j+r.outlinewidth/2+h.bBox(K._axislayer.node()).width;if((z=at.select("text")).node()&&!z.classed(_.jsPlaceholder)){var i,o=at.select(".h"+K._id+"title-math-group").node();i=o&&-1!==["top","bottom"].indexOf(r.titleside)?h.bBox(o).width:h.bBox(at.node()).right-X-A.l,n=Math.max(n,i)}var s=2*r.xpad+n+r.borderwidth+r.outlinewidth/2,l=Z-Q;it.select(".cbbg").attr({x:X-r.xpad-(r.borderwidth+r.outlinewidth)/2,y:Q-q,width:Math.max(s,2),height:Math.max(l+2*q,2)}).call(d.fill,r.bgcolor).call(d.stroke,r.bordercolor).style({"stroke-width":r.borderwidth}),it.selectAll(".cboutline").attr({x:X,y:Q+r.ypad+("top"===r.titleside?ot:0),width:Math.max(j,2),height:Math.max(l-2*r.ypad-ot,2)}).call(d.stroke,r.outlinecolor).style({fill:"None","stroke-width":r.outlinewidth});var u=({center:.5,right:1}[r.xanchor]||0)*s;it.attr("transform","translate("+(A.l-u)+","+A.t+")"),a.autoMargin(t,e,{x:r.x,y:r.y,l:s*({right:1,center:.5}[r.xanchor]||0),r:s*({left:1,center:.5}[r.xanchor]||0),t:l*({bottom:1,middle:.5}[r.yanchor]||0),b:l*({top:1,middle:.5}[r.yanchor]||0)})}],t);if(dt&&dt.then&&(t._promises||[]).push(dt),t._context.edits.colorbarPosition)l.init({element:it.node(),gd:t,prepFn:function(){ct=it.attr("transform"),f(it)},moveFn:function(t,e){it.attr("transform",ct+" translate("+t+","+e+")"),ft=l.align(W+t/A.w,B,0,1,r.xanchor),ht=l.align(Y-e/A.h,V,0,1,r.yanchor);var n=l.getCursor(ft,ht,r.xanchor,r.yanchor);f(it,n)},doneFn:function(){f(it),void 0!==ft&&void 0!==ht&&o.call("restyle",t,{"colorbar.x":ft,"colorbar.y":ht},M().index)}});return dt}function pt(t,e){return u.coerce(J,K,b,t,e)}function gt(e,r){var n,i=M();n=o.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:K,propName:n,traceIndex:i.index,placeholder:x._dfltTitle.colorbar,containerGroup:it.select(".cbtitle")},s="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+s+",."+s+"-math-group").remove(),p.draw(t,e,c(a,r||{}))}x._infolayer.selectAll("g."+e).remove()}function M(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,s.reversescale?a(y):y),l.autocolorscale||f("autocolorscale",!1))}},{"../../lib":481,"./flip_scale":369,"./scales":376}],365:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendFlat;t("./scales.js");e.exports=function(t,e,r){return{color:{valType:"color",arrayOk:!0,editType:e||"style"},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{impliedEdits:{cmin:void 0,cmax:void 0}}),cmax:i({},n.zmax,{editType:e||n.zmax.editType,impliedEdits:{cauto:!1}}),cmin:i({},n.zmin,{editType:e||n.zmin.editType,impliedEdits:{cauto:!1}}),autocolorscale:i({},n.autocolorscale,{dflt:!1===r?r:n.autocolorscale.dflt}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":473,"./attributes":363,"./scales.js":376}],366:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":376}],367:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../colorbar/has_colorbar"),o=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,r,u,c){var f,h=c.prefix,d=c.cLetter,p=h.slice(0,h.length-1),g=h?i.nestedProperty(t,p).get()||{}:t,v=h?i.nestedProperty(e,p).get()||{}:e,m=g[d+"min"],y=g[d+"max"],b=g.colorscale;u(h+d+"auto",!(n(m)&&n(y)&&m=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],370:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./default_scale"),a=t("./is_valid_scale_array");e.exports=function(t,e){if(e||(e=i),!t)return e;function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return"string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e}},{"./default_scale":366,"./is_valid_scale_array":374,"./scales":376}],371:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("./is_valid_scale");e.exports=function(t,e){var r=e?i.nestedProperty(t,e).get()||{}:t,o=r.color,s=!1;if(i.isArrayOrTypedArray(o))for(var l=0;l4/3-s?o:s}},{}],378:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,a){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":481}],379:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),i=t("has-hover"),a=t("has-passive-events"),o=t("../../registry"),s=t("../../lib"),l=t("../../plots/cartesian/constants"),u=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var f=t("./unhover");function h(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function d(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}c.unhover=f.wrapped,c.unhoverRaw=f.raw,c.init=function(t){var e,r,n,f,p,g,v,m,y=t.gd,b=1,x=u.DBLCLICKDELAY,_=t.element;y._mouseDownTime||(y._mouseDownTime=0),_.style.pointerEvents="all",_.onmousedown=M,a?(_._ontouchstart&&_.removeEventListener("touchstart",_._ontouchstart),_._ontouchstart=M,_.addEventListener("touchstart",M,{passive:!1})):_.ontouchstart=M;var w=t.clampFn||function(t,e,r){return Math.abs(t)x&&(b=Math.max(b-1,1)),y._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(b,g),!m){var r;try{r=new MouseEvent("click",e)}catch(t){var n=d(e);(r=document.createEvent("MouseEvents")).initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,n[0],n[1],e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}v.dispatchEvent(r)}!function(t){t._dragging=!1,t._replotPending&&o.call("plot",t)}(y),y._dragged=!1}else y._dragged=!1}},c.coverSlip=h},{"../../constants/interactions":460,"../../lib":481,"../../plots/cartesian/constants":530,"../../registry":577,"./align":377,"./cursor":378,"./unhover":380,"has-hover":231,"has-passive-events":232,"mouse-event-offset":251}],380:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=t("../../lib/throttle"),a=t("../../lib/get_graph_div"),o=t("../fx/constants"),s=e.exports={};s.wrapped=function(t,e,r){(t=a(t))._fullLayout&&i.clear(t._fullLayout._uid+o.HOVERID),s.raw(t,e,r)},s.raw=function(t,e){var r=t._fullLayout,i=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":472,"../../lib/get_graph_div":477,"../../lib/throttle":505,"../fx/constants":394}],381:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],382:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../../registry"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),h=t("../../constants/alignment").LINE_SPACING,d=t("../../constants/interactions").DESELECTDIM,p=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),v=e.exports={};v.font=function(t,e,r,n){u.isPlainObject(e)&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},v.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},v.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},v.setRect=function(t,e,r,n,i){t.call(v.setPosition,e,r).call(v.setSize,n,i)},v.translatePoint=function(t,e,r,n){var a=r.c2p(t.x),o=n.c2p(t.y);return!!(i(a)&&i(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0)},v.translatePoints=function(t,e,r){t.each(function(t){var i=n.select(this);v.translatePoint(t,i,e,r)})},v.hideOutsideRangePoint=function(t,e,r,n,i,a){e.attr("display",r.isPtWithinRange(t,i)&&n.isPtWithinRange(t,a)?null:"none")},v.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,i=e.yaxis;t.each(function(e){var a=e[0].trace,o=a.xcalendar,s=a.ycalendar,l="bar"===a.type?".bartext":".point,.textpoint";t.selectAll(l).each(function(t){v.hideOutsideRangePoint(t,n.select(this),r,i,o,s)})})}},v.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},v.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,l=i||a.dash||"";s.stroke(e,n||a.color),v.dashLine(e,l,o)},v.lineGroupStyle=function(t,e,r,i){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=i||a.dash||"";n.select(this).call(s.stroke,r||a.color).call(v.dashLine,l,o)})},v.dashLine=function(t,e,r){r=+r||0,e=v.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},v.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},v.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(s.fill,e)},v.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=n.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t),r.remove()}})};var m=t("./symbol_defs");v.symbolNames=[],v.symbolFuncs=[],v.symbolNeedLines={},v.symbolNoDot={},v.symbolNoFill={},v.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];v.symbolList=v.symbolList.concat([e.n,t,e.n+100,t+"-open"]),v.symbolNames[e.n]=t,v.symbolFuncs[e.n]=e.f,e.needLine&&(v.symbolNeedLines[e.n]=!0),e.noDot?v.symbolNoDot[e.n]=!0:v.symbolList=v.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"]),e.noFill&&(v.symbolNoFill[e.n]=!0)});var y=v.symbolNames.length,b="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";function x(t,e){var r=t%100;return v.symbolFuncs[r](e)+(t>=200?b:"")}v.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),(t=v.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=y||t>=400?0:Math.floor(Math.max(t,0))};var _={x1:1,x2:0,y1:0,y2:0},w={x1:0,x2:0,y1:1,y2:0};v.gradient=function(t,e,r,i,o,l){var c=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([i+o+l],u.identity);c.exit().remove(),c.enter().append("radial"===i?"radialGradient":"linearGradient").each(function(){var t=n.select(this);"horizontal"===i?t.attr(_):"vertical"===i&&t.attr(w),t.attr("id",r);var e=a(o),u=a(l);t.append("stop").attr({offset:"0%","stop-color":s.tinyRGB(u),"stop-opacity":u.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":s.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},v.initGradients=function(t){u.ensureSingle(t._fullLayout._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove()},v.pointStyle=function(t,e,r){if(t.size()){var i=v.makePointStyleFns(e);t.each(function(t){v.singlePointStyle(t,n.select(this),e,i,r)})}},v.singlePointStyle=function(t,e,r,n,i){var a=r.marker,o=a.line;if(e.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(t):void 0===t.mo?a.opacity:t.mo),n.ms2mrc){var l;l="various"===t.ms||"various"===a.size?3:n.ms2mrc(t.ms),t.mrc=l,n.selectedSizeFn&&(l=t.mrc=n.selectedSizeFn(t));var c=v.symbolNumber(t.mx||a.symbol)||0;t.om=c%200>=100,e.attr("d",x(c,l))}var f,h,d,p=!1;if(t.so?(d=o.outlierwidth,h=o.outliercolor,f=a.outliercolor):(d=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=n.lineScale(t.mlc):u.isArrayOrTypedArray(o.color)?s.defaultLine:o.color,u.isArrayOrTypedArray(a.color)&&(f=s.defaultLine,p=!0),f="mc"in t?t.mcc=n.markerScale(t.mc):a.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(t))),t.om)e.call(s.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var g=a.gradient,m=t.mgt;if(m?p=!0:m=g&&g.type,m&&"none"!==m){var y=t.mgc;y?p=!0:y=g.color;var b="g"+i._fullLayout._uid+"-"+r.uid;p&&(b+="-"+t.i),e.call(v.gradient,i,b,m,f,y)}else e.call(s.fill,f);d&&e.call(s.stroke,h)}},v.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=v.tryColorscale(r,""),e.lineScale=v.tryColorscale(r,"line"),o.traceIs(t,"symbols")&&(e.ms2mrc=p.isBubble(t)?g(t):function(){return(r.size||6)/2}),t.selectedpoints&&u.extendFlat(e,v.makeSelectedPointStyleFns(t)),e},v.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},i=t.marker||{},a=r.marker||{},s=n.marker||{},l=i.opacity,c=a.opacity,f=s.opacity,h=void 0!==c,p=void 0!==f;(u.isArrayOrTypedArray(l)||h||p)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?i.opacity:t.mo;return t.selected?h?c:e:p?f:d*e});var g=i.color,v=a.color,m=s.color;(v||m)&&(e.selectedColorFn=function(t){var e=t.mcc||g;return t.selected?v||e:m||e});var y=i.size,b=a.size,x=s.size,_=void 0!==b,w=void 0!==x;return o.traceIs(t,"symbols")&&(_||w)&&(e.selectedSizeFn=function(t){var e=t.mrc||y/2;return t.selected?_?b/2:e:w?x/2:e}),e},v.makeSelectedTextStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},i=t.textfont||{},a=r.textfont||{},o=n.textfont||{},l=i.color,u=a.color,c=o.color;return e.selectedTextColorFn=function(t){var e=t.tc||l;return t.selected?u||e:c||(u?e:s.addOpacity(e,d))},e},v.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=v.makeSelectedPointStyleFns(e),i=e.marker||{},a=[];r.selectedOpacityFn&&a.push(function(t,e){t.style("opacity",r.selectedOpacityFn(e))}),r.selectedColorFn&&a.push(function(t,e){s.fill(t,r.selectedColorFn(e))}),r.selectedSizeFn&&a.push(function(t,e){var n=e.mx||i.symbol||0,a=r.selectedSizeFn(e);t.attr("d",x(v.symbolNumber(n),a)),e.mrc2=a}),a.length&&t.each(function(t){for(var e=n.select(this),r=0;r0?r:0}v.textPointStyle=function(t,e,r){if(t.size()){var i;if(e.selectedpoints){var a=v.makeSelectedTextStyleFns(e);i=a.selectedTextColorFn}t.each(function(t){var a=n.select(this),o=u.extractOption(t,e,"tx","text");if(o||0===o){var s=t.tp||e.textposition,l=T(t,e),f=i?i(t):t.tc||e.textfont.color;a.call(v.font,t.tf||e.textfont.family,l,f).text(o).call(c.convertToTspans,r).call(A,s,l,t.mrc)}else a.remove()})}},v.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=v.makeSelectedTextStyleFns(e);t.each(function(t){var i=n.select(this),a=r.selectedTextColorFn(t),o=t.tp||e.textposition,l=T(t,e);s.fill(i,a),A(i,o,l,t.mrc2||t.mrc)})}};var k=.5;function E(t,e,r,i){var a=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(a*a+o*o,k/2),c=Math.pow(s*s+l*l,k/2),f=(c*c*a-u*u*s)*i,h=(c*c*o-u*u*l)*i,d=3*c*(u+c),p=3*u*(u+c);return[[n.round(e[0]+(d&&f/d),2),n.round(e[1]+(d&&h/d),2)],[n.round(e[0]-(p&&f/p),2),n.round(e[1]-(p&&h/p),2)]]}v.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],i=[];for(r=1;r=1e4&&(v.savedBBoxes={},C=0),r&&(v.savedBBoxes[r]=m),C++,u.extendFlat({},m)},v.setClipUrl=function(t,e){if(e){if(void 0===v.baseUrl){var r=n.select("base");r.size()&&r.attr("href")?v.baseUrl=window.location.href.split("#")[0]:v.baseUrl=""}t.attr("clip-path","url("+v.baseUrl+"#"+e+")")}else t.attr("clip-path",null)},v.getTranslate=function(t){var e=(t[t.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+e[0]||0,y:+e[1]||0}},v.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||0,r=r||0,a=a.replace(/(\btranslate\(.*?\);?)/,"").trim(),a=(a+=" translate("+e+", "+r+")").trim(),t[i]("transform",a),a},v.getScale=function(t){var e=(t[t.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+e[0]||1,y:+e[1]||1}},v.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||1,r=r||1,a=a.replace(/(\bscale\(.*?\);?)/,"").trim(),a=(a+=" scale("+e+", "+r+")").trim(),t[i]("transform",a),a};var O=/\s*sc.*/;v.setPointGroupScale=function(t,e,r){if(e=e||1,r=r||1,t){var n=1===e&&1===r?"":" scale("+e+","+r+")";t.each(function(){var t=(this.getAttribute("transform")||"").replace(O,"");t=(t+=n).trim(),this.setAttribute("transform",t)})}};var R=/translate\([^)]*\)\s*$/;v.setTextPointsScale=function(t,e,r){t&&t.each(function(){var t,i=n.select(this),a=i.select("text");if(a.node()){var o=parseFloat(a.attr("x")||0),s=parseFloat(a.attr("y")||0),l=(i.attr("transform")||"").match(R);t=1===e&&1===r?[]:["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"],l&&t.push(l),i.attr("transform",t.join(" "))}})}},{"../../constants/alignment":457,"../../constants/interactions":460,"../../constants/xmlns_namespaces":463,"../../lib":481,"../../lib/svg_text_utils":504,"../../registry":577,"../../traces/scatter/make_bubble_size_func":618,"../../traces/scatter/subtypes":623,"../color":357,"../colorscale":372,"./symbol_defs":383,d3:80,"fast-isnumeric":90,tinycolor2:322}],383:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(-.309*t,2);return"M"+e+","+a+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),u=n.round(.118*e,2),c=n.round(.809*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+i+o+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+i+o+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0,noFill:!0}}},{d3:80}],384:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean",editType:"calc"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"],editType:"calc"},symmetric:{valType:"boolean",editType:"calc"},array:{valType:"data_array",editType:"calc"},arrayminus:{valType:"data_array",editType:"calc"},value:{valType:"number",min:0,dflt:10,editType:"calc"},valueminus:{valType:"number",min:0,dflt:10,editType:"calc"},traceref:{valType:"integer",min:0,dflt:0,editType:"style"},tracerefminus:{valType:"integer",min:0,dflt:0,editType:"style"},copy_ystyle:{valType:"boolean",editType:"plot"},copy_zstyle:{valType:"boolean",editType:"style"},color:{valType:"color",editType:"style"},thickness:{valType:"number",min:0,dflt:2,editType:"style"},width:{valType:"number",min:0,editType:"plot"},editType:"calc",_deprecated:{opacity:{valType:"number",editType:"style"}}}},{}],385:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../registry"),a=t("../../plots/cartesian/axes"),o=t("./compute_error");function s(t,e,r,i){var s=e["error_"+i]||{},l=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=o(s),c=0;c0;t.each(function(t){var c,f=t[0].trace,h=f.error_x||{},d=f.error_y||{};f.ids&&(c=function(t){return t.id});var p=o.hasMarkers(f)&&f.marker.maxdisplayed>0;d.visible||h.visible||(t=[]);var g=n.select(this).selectAll("g.errorbar").data(t,c);if(g.exit().remove(),t.length){h.visible||g.selectAll("path.xerror").remove(),d.visible||g.selectAll("path.yerror").remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);u&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),a.setClipUrl(g,e.layerClipId),g.each(function(t){var e=n.select(this),a=function(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),i(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0)));void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),i(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0)));return n}(t,s,l);if(!p||t.vis){var o,c=e.select("path.yerror");if(d.visible&&i(a.x)&&i(a.yh)&&i(a.ys)){var f=d.width;o="M"+(a.x-f)+","+a.yh+"h"+2*f+"m-"+f+",0V"+a.ys,a.noYS||(o+="m-"+f+",0h"+2*f),!c.size()?c=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(c=c.transition().duration(r.duration).ease(r.easing)),c.attr("d",o)}else c.remove();var g=e.select("path.xerror");if(h.visible&&i(a.y)&&i(a.xh)&&i(a.xs)){var v=(h.copy_ystyle?d:h).width;o="M"+a.xh+","+(a.y-v)+"v"+2*v+"m0,-"+v+"H"+a.xs,a.noXS||(o+="m0,-"+v+"v"+2*v),!g.size()?g=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(g=g.transition().duration(r.duration).ease(r.easing)),g.attr("d",o)}else g.remove()}})}})}},{"../../traces/scatter/subtypes":623,"../drawing":382,d3:80,"fast-isnumeric":90}],390:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},a=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),a.copy_ystyle&&(a=r),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":357,d3:80}],391:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0,editType:"none"},bordercolor:{valType:"color",arrayOk:!0,editType:"none"},font:n({arrayOk:!0,editType:"none"}),namelength:{valType:"integer",min:-1,arrayOk:!0,editType:"none"},editType:"calc"}}},{"../../plots/font_attributes":551}],392:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry");function a(t,e,r,i){i=i||n.identity,Array.isArray(t)&&(e[0][r]=i(t))}e.exports=function(t){var e=t.calcdata,r=t._fullLayout;function o(t){return function(e){return n.coerceHoverinfo({hoverinfo:e},{_module:t._module},r)}}for(var s=0;s=0&&r.index-1&&o.length>y&&(o=y>3?o.substr(0,y-3)+"...":o.substr(0,y))}void 0!==t.zLabel?(void 0!==t.xLabel&&(u+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(u+="y: "+t.yLabel+"
"),u+=(u?"z: ":"")+t.zLabel):C&&t[i+"Label"]===A?u=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(u=t.yLabel):u=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(u+=(u?"
":"")+t.text),void 0!==t.extraText&&(u+=(u?"
":"")+t.extraText),""===u&&(""===o&&e.remove(),u=o);var b=e.select("text.nums").call(c.font,t.fontFamily||p,t.fontSize||g,t.fontColor||v).text(u).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r),x=e.select("text.name"),_=0;o&&o!==u?(x.call(c.font,t.fontFamily||p,t.fontSize||g,d).text(o).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r),_=x.node().getBoundingClientRect().width+2*M):(x.remove(),e.select("rect").remove()),e.select("path").style({fill:d,stroke:v});var T,k,P=b.node().getBoundingClientRect(),O=t.xa._offset+(t.x0+t.x1)/2,R=t.ya._offset+(t.y0+t.y1)/2,I=Math.abs(t.x1-t.x0),N=Math.abs(t.y1-t.y0),z=P.width+w+M+_;t.ty0=E-P.top,t.bx=P.width+2*M,t.by=P.height+2*M,t.anchor="start",t.txwidth=P.width,t.tx2width=_,t.offset=0,a?(t.pos=O,T=R+N/2+z<=L,k=R-N/2-z>=0,"top"!==t.idealAlign&&T||!k?T?(R+=N/2,t.anchor="start"):t.anchor="middle":(R-=N/2,t.anchor="end")):(t.pos=R,T=O+I/2+z<=S,k=O-I/2-z>=0,"left"!==t.idealAlign&&T||!k?T?(O+=I/2,t.anchor="start"):t.anchor="middle":(O-=I/2,t.anchor="end")),b.attr("text-anchor",t.anchor),_&&x.attr("text-anchor",t.anchor),e.attr("transform","translate("+O+","+R+")"+(a?"rotate("+m+")":""))}),z}function T(t,e){t.each(function(t){var r=n.select(this);if(t.del)r.remove();else{var i="end"===t.anchor?-1:1,a=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],s=o*(w+M),u=s+o*(t.txwidth+M),f=0,h=t.offset;"middle"===t.anchor&&(s-=t.tx2width/2,u+=t.txwidth/2+M),e&&(h*=-_,f=t.offset*x),r.select("path").attr("d","middle"===t.anchor?"M-"+(t.bx/2+t.tx2width/2)+","+(h-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(i*w+f)+","+(w+h)+"v"+(t.by/2-w)+"h"+i*t.bx+"v-"+t.by+"H"+(i*w+f)+"V"+(h-w)+"Z"),a.call(l.positionText,s+f,h+t.ty0-t.by/2+M),t.tx2width&&(r.select("text.name").call(l.positionText,u+o*M+f,h+t.ty0-t.by/2+M),r.select("rect").call(c.setRect,u+(o-1)*t.tx2width/2+f,h-t.by/2-1,t.tx2width,t.by+2))}})}function k(t,e){var r=t.index,n=t.trace||{},i=t.cd[0],a=t.cd[r]||{},s=Array.isArray(r)?function(t,e){return o.castOption(i,r,t)||o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(a,n,t,e)};function l(e,r,n){var i=s(r,n);i&&(t[e]=i)}if(l("hoverinfo","hi","hoverinfo"),l("color","hbg","hoverlabel.bgcolor"),l("borderColor","hbc","hoverlabel.bordercolor"),l("fontFamily","htf","hoverlabel.font.family"),l("fontSize","hts","hoverlabel.font.size"),l("fontColor","htc","hoverlabel.font.color"),l("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?t.xa._offset+(t.x0+t.x1)/2:t.ya._offset+(t.y0+t.y1)/2,t.x0=o.constrain(t.x0,0,t.xa._length),t.x1=o.constrain(t.x1,0,t.xa._length),t.y0=o.constrain(t.y0,0,t.ya._length),t.y1=o.constrain(t.y1,0,t.ya._length),void 0!==t.xLabelVal&&(t.xLabel="xLabel"in t?t.xLabel:d.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:d.hoverLabelText(t.ya,t.yLabelVal),t.yVal=t.ya.c2d(t.yLabelVal)),void 0!==t.zLabelVal&&void 0===t.zLabel&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=d.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+d.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=d.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+d.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(-1===(f=Array.isArray(f)?f:f.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function E(t,e){var r,n,i=e.container,o=e.fullLayout,s=e.event,l=!!t.hLinePoint,u=!!t.vLinePoint;if(i.selectAll(".spikeline").remove(),u||l){var h=f.combine(o.plot_bgcolor,o.paper_bgcolor);if(l){var d,p,g=t.hLinePoint;r=g&&g.xa,"cursor"===(n=g&&g.ya).spikesnap?(d=s.pointerX,p=s.pointerY):(d=r._offset+g.x,p=n._offset+g.y);var v,m,y=a.readability(g.color,h)<1.5?f.contrast(h):g.color,b=n.spikemode,x=n.spikethickness,_=n.spikecolor||y,w=n._boundingBox,M=(w.left+w.right)/2w[0]._length||tt<0||tt>M[0]._length)return h.unhoverRaw(t,e)}if(e.pointerX=$+w[0]._offset,e.pointerY=tt+M[0]._offset,N="xval"in e?g.flat(l,e.xval):g.p2c(w,$),z="yval"in e?g.flat(l,e.yval):g.p2c(M,tt),!i(N[0])||!i(z[0]))return o.warn("Fx.hover failed",e,t),h.unhoverRaw(t,e)}var nt=1/0;for(F=0;FW&&(Q.splice(0,W),nt=Q[0].distance),y&&0!==Z&&0===Q.length){X.distance=Z,X.index=!1;var lt=B._module.hoverPoints(X,q,G,"closest",c._hoverlayer);if(lt&&(lt=lt.filter(function(t){return t.spikeDistance<=Z})),lt&<.length){var ut,ct=lt.filter(function(t){return t.xa.showspikes});if(ct.length){var ft=ct[0];i(ft.x0)&&i(ft.y0)&&(ut=gt(ft),(!K.vLinePoint||K.vLinePoint.spikeDistance>ut.spikeDistance)&&(K.vLinePoint=ut))}var ht=lt.filter(function(t){return t.ya.showspikes});if(ht.length){var dt=ht[0];i(dt.x0)&&i(dt.y0)&&(ut=gt(dt),(!K.hLinePoint||K.hLinePoint.spikeDistance>ut.spikeDistance)&&(K.hLinePoint=ut))}}}}function pt(t,e){for(var r,n=null,i=1/0,a=0;a1,St=f.combine(c.plot_bgcolor||f.background,c.paper_bgcolor),Lt={hovermode:I,rotateLabels:Et,bgColor:St,container:c._hoverlayer,outerContainer:c._paperdiv,commonLabelOpts:c.hoverlabel,hoverdistance:c.hoverdistance},Ct=A(Q,Lt,t);if(function(t,e,r){var n,i,a,o,s,l,u,c=0,f=t.map(function(t,n){var i=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===i._id.charAt(0)?b:1)/2,pmin:0,pmax:"x"===i._id.charAt(0)?r.width:r.height}]}).sort(function(t,e){return t[0].posref-e[0].posref});function h(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(a<.01)){if(i<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=a;n=!1}if(n){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)(l=t[o]).pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)(l=t[o]).pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(;!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&g.pmin===v.pmin&&g.pmax===v.pmax){for(s=p.length-1;s>=0;s--)p[s].dp+=i;for(d.push.apply(d,p),f.splice(o+1,1),u=0,s=d.length-1;s>=0;s--)u+=d[s].dp;for(a=u/d.length,s=d.length-1;s>=0;s--)d[s].dp-=a;n=!1}else o++}f.forEach(h)}for(o=f.length-1;o>=0;o--){var m=f[o];for(s=m.length-1;s>=0;s--){var y=m[s],x=t[y.i];x.offset=y.dp,x.del=y.del}}}(Q,Et?"xa":"ya",c),T(Ct,Et),e.target&&e.target.tagName){var Pt=p.getComponentMethod("annotations","hasClickToShow")(t,Tt);u(n.select(e.target),Pt?"pointer":"")}if(!e.target||a||!function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}(t,0,At))return;At&&t.emit("plotly_unhover",{event:e,points:At});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:w,yaxes:M,xvals:N,yvals:z})}(t,e,r,a)})},r.loneHover=function(t,e){var r={color:t.color||f.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},i=n.select(e.container),a=e.outerContainer?n.select(e.outerContainer):i,o={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||f.background,container:i,outerContainer:a},s=A([r],o,e.gd);return T(s,o.rotateLabels),s.node()}},{"../../lib":481,"../../lib/events":472,"../../lib/override_cursor":492,"../../lib/svg_text_utils":504,"../../plots/cartesian/axes":525,"../../registry":577,"../color":357,"../dragelement":379,"../drawing":382,"./constants":394,"./helpers":396,d3:80,"fast-isnumeric":90,tinycolor2:322}],398:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){r("hoverlabel.bgcolor",(i=i||{}).bgcolor),r("hoverlabel.bordercolor",i.bordercolor),r("hoverlabel.namelength",i.namelength),n.coerceFont(r,"hoverlabel.font",i.font)}},{"../../lib":481}],399:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../dragelement"),o=t("./helpers"),s=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:s},attributes:t("./attributes"),layoutAttributes:s,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:o.getDistanceFunction,getClosest:o.getClosest,inbox:o.inbox,quadrature:o.quadrature,appendArrayPointValue:o.appendArrayPointValue,castHoverOption:function(t,e,r){return i.castOption(t,e,"hoverlabel."+r)},castHoverinfo:function(t,e,r){return i.castOption(t,r,"hoverinfo",function(r){return i.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)})},hover:t("./hover").hover,unhover:a.unhover,loneHover:t("./hover").loneHover,loneUnhover:function(t){var e=i.isD3Selection(t)?t:n.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()},click:t("./click")}},{"../../lib":481,"../dragelement":379,"./attributes":391,"./calc":392,"./click":393,"./constants":394,"./defaults":395,"./helpers":396,"./hover":397,"./layout_attributes":400,"./layout_defaults":401,"./layout_global_defaults":402,d3:80}],400:[function(t,e,r){"use strict";var n=t("./constants"),i=t("../../plots/font_attributes")({editType:"none"});i.family.dflt=n.HOVERFONT,i.size.dflt=n.HOVERFONTSIZE,e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom",editType:"modebar"},hovermode:{valType:"enumerated",values:["x","y","closest",!1],editType:"modebar"},hoverdistance:{valType:"integer",min:-1,dflt:20,editType:"none"},spikedistance:{valType:"integer",min:-1,dflt:20,editType:"none"},hoverlabel:{bgcolor:{valType:"color",editType:"none"},bordercolor:{valType:"color",editType:"none"},font:i,namelength:{valType:"integer",min:-1,dflt:15,editType:"none"},editType:"none"},selectdirection:{valType:"enumerated",values:["h","v","d","any"],dflt:"any",editType:"none"}}},{"../../plots/font_attributes":551,"./constants":394}],401:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,r){function a(r,a){return n.coerce(t,e,i,r,a)}var o;"select"===a("dragmode")&&a("selectdirection"),e._has("cartesian")?(e._isHoriz=function(t){for(var e=!0,r=0;r1){f||h||d||"independent"===M("pattern")&&(f=!0),g._hasSubplotGrid=f;var y,b,x="top to bottom"===M("roworder"),_=f?.2:.1,w=f?.3:.1;p&&e._splomGridDflt&&(y=e._splomGridDflt.xside,b=e._splomGridDflt.yside),g._domains={x:u("x",M,_,y,m),y:u("y",M,w,b,v,x)},e.grid=g}}function M(t,e){return n.coerce(r,g,s,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,i,a,o,s,u,f,h=t.grid||{},d=e._subplots,p=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(p){var b=h.subplots||[];u=r.subplots=new Array(g);var x=1;for(n=0;n=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],410:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes");e.exports={bgcolor:{valType:"color",editType:"legend"},bordercolor:{valType:"color",dflt:i.defaultLine,editType:"legend"},borderwidth:{valType:"number",min:0,dflt:0,editType:"legend"},font:n({editType:"legend"}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v",editType:"legend"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"],editType:"legend"},tracegroupgap:{valType:"number",min:0,dflt:10,editType:"legend"},x:{valType:"number",min:-2,max:3,dflt:1.02,editType:"legend"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left",editType:"legend"},y:{valType:"number",min:-2,max:3,dflt:1,editType:"legend"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"legend"},editType:"legend"}},{"../../plots/font_attributes":551,"../color/attributes":356}],411:[function(t,e,r){"use strict";e.exports={scrollBarWidth:6,scrollBarMinHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],412:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,r){for(var l,u,c,f,h=t.legend||{},d={},p=0,g="normal",v=0;v1)){if(e.legend=d,y("bgcolor",e.paper_bgcolor),y("bordercolor"),y("borderwidth"),i.coerceFont(y,"font",e.font),y("orientation"),"h"===d.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(l=0,c="left",u=1.1,f="bottom"):(l=0,c="left",u=-.1,f="top")}y("traceorder",g),s.isGrouped(e.legend)&&y("tracegroupgap"),y("x",l),y("xanchor",c),y("y",u),y("yanchor",f),i.noneOrAll(h,d,["x","y"])}}},{"../../lib":481,"../../plots/layout_attributes":566,"../../registry":577,"./attributes":410,"./helpers":416}],413:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib/events"),l=t("../dragelement"),u=t("../drawing"),c=t("../color"),f=t("../../lib/svg_text_utils"),h=t("./handle_click"),d=t("./constants"),p=t("../../constants/interactions"),g=t("../../constants/alignment"),v=g.LINE_SPACING,m=g.FROM_TL,y=g.FROM_BR,b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=t("./anchor_utils"),M=p.DBLCLICKDELAY;function A(t,e,r,n,i){var a=r.data()[0][0].trace,o={event:i,node:r.node(),curveNumber:a.index,expandedIndex:a._expandedIndex,data:t.data,layout:t.layout,frames:t._transitionData._frames,config:t._context,fullData:t._fullData,fullLayout:t._fullLayout};if(a._group&&(o.group=a._group),"pie"===a.type&&(o.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",o))if(1===n)e._clickTimeout=setTimeout(function(){h(r,t,n)},M);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",o)&&h(r,t,n)}}function T(t,e,r){var n=t.data()[0][0],a=e._fullLayout,s=n.trace,l=o.traceIs(s,"pie"),c=s.index,h=l?n.label:s.name,d=e._context.edits.legendText&&!l,p=i.ensureSingle(t,"text","legendtext");function g(r){f.convertToTspans(r,e,function(){!function(t,e){var r=t.data()[0][0];if(!r.trace.showlegend)return void t.remove();var n,i,a=t.select("g[class*=math-group]"),o=a.node(),s=e._fullLayout.legend.font.size*v;if(o){var l=u.bBox(o);n=l.height,i=l.width,u.setTranslate(a,0,n/4)}else{var c=t.select(".legendtext"),h=f.lineCount(c),d=c.node();n=s*h,i=d?u.bBox(d).width:0;var p=s*(.3+(1-h)/2);f.positionText(c,40,p)}n=Math.max(n,16)+3,r.height=n,r.width=i}(t,e)})}p.attr("text-anchor","start").classed("user-select-none",!0).call(u.font,a.legend.font).text(d?k(h,r):h),d?p.call(f.makeEditable,{gd:e,text:h}).call(g).on("edit",function(t){this.text(k(t,r)).call(g);var a=n.trace._fullInput||{},s={};if(o.hasTransform(a,"groupby")){var l=o.getTransformIndices(a,"groupby"),u=l[l.length-1],f=i.keyedContainer(a,"transforms["+u+"].styles","target","value.name");f.set(n.trace._group,t),s=f.constructUpdate()}else s.name=t;return o.call("restyle",e,s,c)}):g(p)}function k(t,e){var r=Math.max(4,e);if(t&&t.trim().length>=r/2)return t;for(var n=r-(t=t||"").length;n>0;n--)t+=" ";return t}function E(t,e){var r,a=1,o=i.ensureSingle(t,"rect","legendtoggle",function(t){t.style("cursor","pointer").attr("pointer-events","all").call(c.fill,"rgba(0,0,0,0)")});o.on("mousedown",function(){(r=(new Date).getTime())-e._legendMouseDownTimeM&&(a=Math.max(a-1,1)),A(e,r,t,a,n.event)}})}function S(t,e,r){var i=t._fullLayout,a=i.legend,o=a.borderwidth,s=_.isGrouped(a),l=0;if(a._width=0,a._height=0,_.isVertical(a))s&&e.each(function(t,e){u.setTranslate(this,0,e*a.tracegroupgap)}),r.each(function(t){var e=t[0],r=e.height,n=e.width;u.setTranslate(this,o,5+o+a._height+r/2),a._height+=r,a._width=Math.max(a._width,n)}),a._width+=45+2*o,a._height+=10+2*o,s&&(a._height+=(a._lgroupsLength-1)*a.tracegroupgap),l=40;else if(s){for(var c=[a._width],f=e.data(),h=0,d=f.length;ho+w-M,r.each(function(t){var e=t[0],r=v?40+t[0].width:b;o+x+M+r>i.width-(i.margin.r+i.margin.l)&&(x=0,m+=y,a._height=a._height+y,y=0),u.setTranslate(this,o+x,5+o+e.height/2+m),a._width+=M+r,a._height=Math.max(a._height,e.height),x+=M+r,y=Math.max(e.height,y)}),a._width+=2*o,a._height+=10+2*o}a._width=Math.ceil(a._width),a._height=Math.ceil(a._height),r.each(function(e){var r=e[0],i=n.select(this).select(".legendtoggle");u.setRect(i,0,-r.height/2,(t._context.edits.legendText?0:a._width)+l,r.height)})}function L(t){var e=t._fullLayout.legend,r="left";w.isRightAnchor(e)?r="right":w.isCenterAnchor(e)&&(r="center");var n="top";w.isBottomAnchor(e)?n="bottom":w.isMiddleAnchor(e)&&(n="middle"),a.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*m[r],r:e._width*y[r],b:e._height*y[n],t:e._height*m[n]})}e.exports=function(t){var e=t._fullLayout,r="legend"+e._uid;if(e._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var s=e.legend,f=e.showlegend&&b(t.calcdata,s),h=e.hiddenlabels||[];if(!e.showlegend||!f.length)return e._infolayer.selectAll(".legend").remove(),e._topdefs.select("#"+r).remove(),void a.autoMargin(t,"legend");for(var p=0,g=0;gj?function(t){var e=t._fullLayout.legend,r="left";w.isRightAnchor(e)?r="right":w.isCenterAnchor(e)&&(r="center");a.autoMargin(t,"legend",{x:e.x,y:.5,l:e._width*m[r],r:e._width*y[r],b:0,t:0})}(t):L(t);var B=e._size,U=B.l+B.w*s.x,V=B.t+B.h*(1-s.y);w.isRightAnchor(s)?U-=s._width:w.isCenterAnchor(s)&&(U-=s._width/2),w.isBottomAnchor(s)?V-=s._height:w.isMiddleAnchor(s)&&(V-=s._height/2);var H=s._width,q=B.w;H>q?(U=B.l,H=q):(U+H>F&&(U=F-H),U<0&&(U=0),H=Math.min(F-U,s._width));var G,X,W,Y,Z=s._height,Q=B.h;if(Z>Q?(V=B.t,Z=Q):(V+Z>j&&(V=j-Z),V<0&&(V=0),Z=Math.min(j-V,s._height)),u.setTranslate(P,U,V),N.on(".drag",null),P.on("wheel",null),s._height<=Z||t._context.staticPlot)R.attr({width:H-s.borderwidth,height:Z-s.borderwidth,x:s.borderwidth/2,y:s.borderwidth/2}),u.setTranslate(I,0,0),O.select("rect").attr({width:H-2*s.borderwidth,height:Z-2*s.borderwidth,x:s.borderwidth,y:s.borderwidth}),u.setClipUrl(I,r),u.setRect(N,0,0,0,0),delete s._scrollY;else{var J,K,$=Math.max(d.scrollBarMinHeight,Z*Z/s._height),tt=Z-$-2*d.scrollBarMargin,et=s._height-Z,rt=tt/et,nt=Math.min(s._scrollY||0,et);R.attr({width:H-2*s.borderwidth+d.scrollBarWidth+d.scrollBarMargin,height:Z-s.borderwidth,x:s.borderwidth/2,y:s.borderwidth/2}),O.select("rect").attr({width:H-2*s.borderwidth+d.scrollBarWidth+d.scrollBarMargin,height:Z-2*s.borderwidth,x:s.borderwidth,y:s.borderwidth+nt}),u.setClipUrl(I,r),at(nt,$,rt),P.on("wheel",function(){at(nt=i.constrain(s._scrollY+n.event.deltaY/tt*et,0,et),$,rt),0!==nt&&nt!==et&&n.event.preventDefault()});var it=n.behavior.drag().on("dragstart",function(){J=n.event.sourceEvent.clientY,K=nt}).on("drag",function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||at(nt=i.constrain((t.clientY-J)/rt+K,0,et),$,rt)});N.call(it)}if(t._context.edits.legendPosition)P.classed("cursor-move",!0),l.init({element:P.node(),gd:t,prepFn:function(){var t=u.getTranslate(P);W=t.x,Y=t.y},moveFn:function(t,e){var r=W+t,n=Y+e;u.setTranslate(P,r,n),G=l.align(r,0,B.l,B.l+B.w,s.xanchor),X=l.align(n,0,B.t+B.h,B.t,s.yanchor)},doneFn:function(){void 0!==G&&void 0!==X&&o.call("relayout",t,{"legend.x":G,"legend.y":X})},clickFn:function(r,n){var i=e._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return n.clientX>=t.left&&n.clientX<=t.right&&n.clientY>=t.top&&n.clientY<=t.bottom});i.size()>0&&A(t,P,i,r,n)}})}function at(e,r,n){s._scrollY=t._fullLayout.legend._scrollY=e,u.setTranslate(I,0,-e),u.setRect(N,H,d.scrollBarMargin+e*n,d.scrollBarWidth,r),O.select("rect").attr({y:s.borderwidth+e})}}},{"../../constants/alignment":457,"../../constants/interactions":460,"../../lib":481,"../../lib/events":472,"../../lib/svg_text_utils":504,"../../plots/plots":568,"../../registry":577,"../color":357,"../dragelement":379,"../drawing":382,"./anchor_utils":409,"./constants":411,"./get_legend_data":414,"./handle_click":415,"./helpers":416,"./style":418,d3:80}],414:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./helpers");e.exports=function(t,e){var r,a,o={},s=[],l=!1,u={},c=0;function f(t,r){if(""!==t&&i.isGrouped(e))-1===s.indexOf(t)?(s.push(t),l=!0,o[t]=[[r]]):o[t].push([r]);else{var n="~~i"+c;s.push(n),o[n]=[[r]],c++}}for(r=0;rr[1])return r[1]}return i}function p(t){return t[0]}if(c||f||h){var g={},v={};c&&(g.mc=d("marker.color",p),g.mo=d("marker.opacity",a.mean,[.2,1]),g.ms=d("marker.size",a.mean,[2,16]),g.mlc=d("marker.line.color",p),g.mlw=d("marker.line.width",a.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(v.line={width:d("line.width",p,[0,10])}),f&&(g.tx="Aa",g.tp=d("textposition",p),g.ts=10,g.tc=d("textfont.color",p),g.tf=d("textfont.family",p)),r=[a.minExtend(s,g)],(i=a.minExtend(u,v)).selectedpoints=null}var m=n.select(this).select("g.legendpoints"),y=m.selectAll("path.scatterpts").data(c?r:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,i,e),c&&(r[0].mrc=3);var b=m.selectAll("g.pointtext").data(f?r:[]);b.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),b.exit().remove(),b.selectAll("text").call(o.textPointStyle,i,e)}).each(function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data("candlestick"===e.type&&e.visible?[t,t]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",function(t,e){return e?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"}).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each(function(t,r){var i=e[r?"increasing":"decreasing"],a=i.line.width,o=n.select(this);o.style("stroke-width",a+"px").call(s.fill,i.fillcolor),a&&s.stroke(o,i.line.color)})}).each(function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data("ohlc"===e.type&&e.visible?[t,t]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",function(t,e){return e?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"}).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each(function(t,r){var i=e[r?"increasing":"decreasing"],a=i.line.width,l=n.select(this);l.style("fill","none").call(o.dashLine,i.line.dash,a),a&&s.stroke(l,i.line.color)})})}},{"../../lib":481,"../../registry":577,"../../traces/pie/style_one":599,"../../traces/scatter/subtypes":623,"../color":357,"../drawing":382,d3:80}],419:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/plots"),a=t("../../plots/cartesian/axis_ids"),o=t("../../lib"),s=t("../../../build/ploticon"),l=o._,u=e.exports={};function c(t,e){var r,i,o=e.currentTarget,s=o.getAttribute("data-attr"),l=o.getAttribute("data-val")||!0,u=t._fullLayout,c={},f=a.list(t,null,!0),h="on";if("zoom"===s){var d,p="in"===l?.5:2,g=(1+p)/2,v=(1-p)/2;for(i=0;i1?(_=["toggleHover"],w=["resetViews"]):f?(x=["zoomInGeo","zoomOutGeo"],_=["hoverClosestGeo"],w=["resetGeo"]):c?(_=["hoverClosest3d"],w=["resetCameraDefault3d","resetCameraLastSave3d"]):g?(_=["toggleHover"],w=["resetViewMapbox"]):_=d?["hoverClosestGl2d"]:h?["hoverClosestPie"]:["toggleHover"];u&&(_=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);!u&&!d||m||(x=["zoomIn2d","zoomOut2d","autoScale2d"],"resetViews"!==w[0]&&(w=["resetScale2d"]));c?M=["zoom3d","pan3d","orbitRotation","tableRotation"]:(u||d)&&!m||p?M=["zoom2d","pan2d"]:g||f?M=["pan2d"]:v&&(M=["zoom2d"]);(function(t){for(var e=!1,r=0;r0)){var p=function(t,e,r){for(var n=r.filter(function(r){return e[r].anchor===t._id}),i=0,a=0;a0?h+u:u;return{ppad:u,ppadplus:c?p:g,ppadminus:c?g:p}}return{ppad:u}}function c(t,e,r,n,i){var s="category"===t.type?t.r2c:t.d2c;if(void 0!==e)return[s(e),s(r)];if(n){var l,u,c,f,h=1/0,d=-1/0,p=n.match(a.segmentRE);for("date"===t.type&&(s=o.decodeDate(s)),l=0;ld&&(d=f)));return d>=h?[h,d]:void 0}}e.exports=function(t){var e=t._fullLayout,r=n.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var o=0;o10?t/2:10;return n.append("circle").attr({"data-line-point":"start-point",cx:X?K(r.xanchor)+r.x0:K(r.x0),cy:W?$(r.yanchor)-r.y0:$(r.y0),r:a}).style(i).classed("cursor-grab",!0),n.append("circle").attr({"data-line-point":"end-point",cx:X?K(r.xanchor)+r.x1:K(r.x1),cy:W?$(r.yanchor)-r.y1:$(r.y1),r:a}).style(i).classed("cursor-grab",!0),n}():e,nt={element:rt.node(),gd:t,prepFn:function(n){var i="shapes["+o+"]";X&&(_=K(r.xanchor),E=i+".xanchor");W&&(w=$(r.yanchor),S=i+".yanchor");"path"===r.type?(U=r.path,V=i+".path"):(m=X?r.x0:K(r.x0),y=W?r.y0:$(r.y0),b=X?r.x1:K(r.x1),x=W?r.y1:$(r.y1),M=i+".x0",A=i+".y0",T=i+".x1",k=i+".y1");mx?(L=y,R=i+".y0",D="y0",C=x,I=i+".y1",F="y1"):(L=x,R=i+".y1",D="y1",C=y,I=i+".y0",F="y0");v={},it(n),st(h,r),function(t,e,r){var n=e.xref,i=e.yref,o=a.getFromId(r,n),l=a.getFromId(r,i),u="";"paper"===n||o.autorange||(u+=n);"paper"===i||l.autorange||(u+=i);t.call(s.setClipUrl,u?"clip"+r._fullLayout._uid+u:null)}(e,r,t),nt.moveFn="move"===H?at:ot},doneFn:function(){u(e),lt(h),d(e,t,r),n.call("relayout",t,v)},clickFn:function(){lt(h)}};function it(t){if(Y)H="path"===t.target.tagName?"move":"start-point"===t.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var r=nt.element.getBoundingClientRect(),n=r.right-r.left,i=r.bottom-r.top,a=t.clientX-r.left,o=t.clientY-r.top,s=!Z&&n>q&&i>G&&!t.shiftKey?l.getCursor(a/n,1-o/i):"move";u(e,s),H=s.split("-")[0]}}function at(n,i){if("path"===r.type){var a=function(t){return t},o=a,s=a;X?v[E]=r.xanchor=tt(_+n):(o=function(t){return tt(K(t)+n)},Q&&"date"===Q.type&&(o=f.encodeDate(o))),W?v[S]=r.yanchor=et(w+i):(s=function(t){return et($(t)+i)},J&&"date"===J.type&&(s=f.encodeDate(s))),r.path=g(U,o,s),v[V]=r.path}else X?v[E]=r.xanchor=tt(_+n):(v[M]=r.x0=tt(m+n),v[T]=r.x1=tt(b+n)),W?v[S]=r.yanchor=et(w+i):(v[A]=r.y0=et(y+i),v[k]=r.y1=et(x+i));e.attr("d",p(t,r)),st(h,r)}function ot(n,i){if(Z){var a=function(t){return t},o=a,s=a;X?v[E]=r.xanchor=tt(_+n):(o=function(t){return tt(K(t)+n)},Q&&"date"===Q.type&&(o=f.encodeDate(o))),W?v[S]=r.yanchor=et(w+i):(s=function(t){return et($(t)+i)},J&&"date"===J.type&&(s=f.encodeDate(s))),r.path=g(U,o,s),v[V]=r.path}else if(Y){if("resize-over-start-point"===H){var l=m+n,u=W?y-i:y+i;v[M]=r.x0=X?l:tt(l),v[A]=r.y0=W?u:et(u)}else if("resize-over-end-point"===H){var c=b+n,d=W?x-i:x+i;v[T]=r.x1=X?c:tt(c),v[k]=r.y1=W?d:et(d)}}else{var rt=~H.indexOf("n")?L+i:L,nt=~H.indexOf("s")?C+i:C,it=~H.indexOf("w")?P+n:P,at=~H.indexOf("e")?O+n:O;~H.indexOf("n")&&W&&(rt=L-i),~H.indexOf("s")&&W&&(nt=C-i),(!W&&nt-rt>G||W&&rt-nt>G)&&(v[R]=r[D]=W?rt:et(rt),v[I]=r[F]=W?nt:et(nt)),at-it>q&&(v[N]=r[j]=X?it:tt(it),v[z]=r[B]=X?at:tt(at))}e.attr("d",p(t,r)),st(h,r)}function st(t,e){(X||W)&&function(){var r="path"!==e.type,n=t.selectAll(".visual-cue").data([0]);n.enter().append("path").attr({fill:"#fff","fill-rule":"evenodd",stroke:"#000","stroke-width":1}).classed("visual-cue",!0);var a=K(X?e.xanchor:i.midRange(r?[e.x0,e.x1]:f.extractPathCoords(e.path,c.paramIsX))),o=$(W?e.yanchor:i.midRange(r?[e.y0,e.y1]:f.extractPathCoords(e.path,c.paramIsY)));if(a=f.roundPositionForSharpStrokeRendering(a,1),o=f.roundPositionForSharpStrokeRendering(o,1),X&&W){var s="M"+(a-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",s)}else if(X){var l="M"+(a-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",l)}else{var u="M"+(a-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",u)}}()}function lt(t){t.selectAll(".visual-cue").remove()}l.init(nt),rt.node().onmousemove=it}(t,y,h,e,r)}}function d(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"");t.call(s.setClipUrl,n?"clip"+e._fullLayout._uid+n:null)}function p(t,e){var r,n,o,s,l,u,h,d,p=e.type,g=a.getFromId(t,e.xref),v=a.getFromId(t,e.yref),m=t._fullLayout._size;if(g?(r=f.shapePositionToRange(g),n=function(t){return g._offset+g.r2p(r(t,!0))}):n=function(t){return m.l+m.w*t},v?(o=f.shapePositionToRange(v),s=function(t){return v._offset+v.r2p(o(t,!0))}):s=function(t){return m.t+m.h*(1-t)},"path"===p)return g&&"date"===g.type&&(n=f.decodeDate(n)),v&&"date"===v.type&&(s=f.decodeDate(s)),function(t,e,r){var n=t.path,a=t.xsizemode,o=t.ysizemode,s=t.xanchor,l=t.yanchor;return n.replace(c.segmentRE,function(t){var n=0,u=t.charAt(0),f=c.paramIsX[u],h=c.paramIsY[u],d=c.numParams[u],p=t.substr(1).replace(c.paramRE,function(t){return f[n]?t="pixel"===a?e(s)+Number(t):e(t):h[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>d&&(t="X"),t});return n>d&&(p=p.replace(/[\s,]*X.*/,""),i.log("Ignoring extra params in segment "+t)),u+p})}(e,n,s);if("pixel"===e.xsizemode){var y=n(e.xanchor);l=y+e.x0,u=y+e.x1}else l=n(e.x0),u=n(e.x1);if("pixel"===e.ysizemode){var b=s(e.yanchor);h=b-e.y0,d=b-e.y1}else h=s(e.y0),d=s(e.y1);if("line"===p)return"M"+l+","+h+"L"+u+","+d;if("rect"===p)return"M"+l+","+h+"H"+u+"V"+d+"H"+l+"Z";var x=(l+u)/2,_=(h+d)/2,w=Math.abs(x-l),M=Math.abs(_-h),A="A"+w+","+M,T=x+w+","+_;return"M"+T+A+" 0 1,1 "+(x+","+(_-M))+A+" 0 0,1 "+T+"Z"}function g(t,e,r){return t.replace(c.segmentRE,function(t){var n=0,i=t.charAt(0),a=c.paramIsX[i],o=c.paramIsY[i],s=c.numParams[i];return i+t.substr(1).replace(c.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}e.exports={draw:function(t){var e=t._fullLayout;for(var r in e._shapeUpperLayer.selectAll("path").remove(),e._shapeLowerLayer.selectAll("path").remove(),e._plots){var n=e._plots[r].shapelayer;n&&n.selectAll("path").remove()}for(var i=0;i0)&&(i("active"),i("x"),i("y"),n.noneOrAll(t,e,["x","y"]),i("xanchor"),i("yanchor"),i("len"),i("lenmode"),i("pad.t"),i("pad.r"),i("pad.b"),i("pad.l"),n.coerceFont(i,"font",r.font),i("currentvalue.visible")&&(i("currentvalue.xanchor"),i("currentvalue.prefix"),i("currentvalue.suffix"),i("currentvalue.offset"),n.coerceFont(i,"currentvalue.font",e.font)),i("transition.duration"),i("transition.easing"),i("bgcolor"),i("activebgcolor"),i("bordercolor"),i("borderwidth"),i("ticklen"),i("tickwidth"),i("tickcolor"),i("minorticklen"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":481,"../../plots/array_container_defaults":521,"./attributes":445,"./constants":446}],448:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plots/plots"),a=t("../color"),o=t("../drawing"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),u=t("../legend/anchor_utils"),c=t("./constants"),f=t("../../constants/alignment"),h=f.LINE_SPACING,d=f.FROM_TL,p=f.FROM_BR;function g(t){return t._index}function v(t,e){var r=o.tester.selectAll("g."+c.labelGroupClass).data(e.steps);r.enter().append("g").classed(c.labelGroupClass,!0);var a=0,s=0;r.each(function(t){var r=b(n.select(this),{step:t},e).node();if(r){var i=o.bBox(r);s=Math.max(s,i.height),a=Math.max(a,i.width)}}),r.remove();var f=e._dims={};f.inputAreaWidth=Math.max(c.railWidth,c.gripHeight);var h=t._fullLayout._size;f.lx=h.l+h.w*e.x,f.ly=h.t+h.h*(1-e.y),"fraction"===e.lenmode?f.outerLength=Math.round(h.w*e.len):f.outerLength=e.len,f.inputAreaStart=0,f.inputAreaLength=Math.round(f.outerLength-e.pad.l-e.pad.r);var g=(f.inputAreaLength-2*c.stepInset)/(e.steps.length-1),v=a+c.labelPadding;if(f.labelStride=Math.max(1,Math.ceil(v/g)),f.labelHeight=s,f.currentValueMaxWidth=0,f.currentValueHeight=0,f.currentValueTotalHeight=0,f.currentValueMaxLines=1,e.currentvalue.visible){var y=o.tester.append("g");r.each(function(t){var r=m(y,e,t.label),n=r.node()&&o.bBox(r.node())||{width:0,height:0},i=l.lineCount(r);f.currentValueMaxWidth=Math.max(f.currentValueMaxWidth,Math.ceil(n.width)),f.currentValueHeight=Math.max(f.currentValueHeight,Math.ceil(n.height)),f.currentValueMaxLines=Math.max(f.currentValueMaxLines,i)}),f.currentValueTotalHeight=f.currentValueHeight+e.currentvalue.offset,y.remove()}f.height=f.currentValueTotalHeight+c.tickOffset+e.ticklen+c.labelOffset+f.labelHeight+e.pad.t+e.pad.b;var x="left";u.isRightAnchor(e)&&(f.lx-=f.outerLength,x="right"),u.isCenterAnchor(e)&&(f.lx-=f.outerLength/2,x="center");var _="top";u.isBottomAnchor(e)&&(f.ly-=f.height,_="bottom"),u.isMiddleAnchor(e)&&(f.ly-=f.height/2,_="middle"),f.outerLength=Math.ceil(f.outerLength),f.height=Math.ceil(f.height),f.lx=Math.round(f.lx),f.ly=Math.round(f.ly),i.autoMargin(t,c.autoMarginIdRoot+e._index,{x:e.x,y:e.y,l:f.outerLength*d[x],r:f.outerLength*p[x],b:f.height*p[_],t:f.height*d[_]})}function m(t,e,r){if(e.currentvalue.visible){var n,i,a=e._dims;switch(e.currentvalue.xanchor){case"right":n=a.inputAreaLength-c.currentValueInset-a.currentValueMaxWidth,i="left";break;case"center":n=.5*a.inputAreaLength,i="middle";break;default:n=c.currentValueInset,i="left"}var u=s.ensureSingle(t,"text",c.labelClass,function(t){t.classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1})}),f=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)f+=r;else f+=e.steps[e.active].label;e.currentvalue.suffix&&(f+=e.currentvalue.suffix),u.call(o.font,e.currentvalue.font).text(f).call(l.convertToTspans,e._gd);var d=l.lineCount(u),p=(a.currentValueMaxLines+1-d)*e.currentvalue.font.size*h;return l.positionText(u,n,p),u}}function y(t,e,r){s.ensureSingle(t,"rect",c.gripRectClass,function(n){n.call(M,e,t,r).style("pointer-events","all")}).attr({width:c.gripWidth,height:c.gripHeight,rx:c.gripRadius,ry:c.gripRadius}).call(a.stroke,r.bordercolor).call(a.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function b(t,e,r){var n=s.ensureSingle(t,"text",c.labelClass,function(t){t.classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1})});return n.call(o.font,r.font).text(e.step.label).call(l.convertToTspans,r._gd),n}function x(t,e){var r=s.ensureSingle(t,"g",c.labelsClass),i=e._dims,a=r.selectAll("g."+c.labelGroupClass).data(i.labelSteps);a.enter().append("g").classed(c.labelGroupClass,!0),a.exit().remove(),a.each(function(t){var r=n.select(this);r.call(b,t,e),o.setTranslate(r,k(e,t.fraction),c.tickOffset+e.ticklen+e.font.size*h+c.labelOffset+i.currentValueTotalHeight)})}function _(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&w(t,e,r,a,!0,i)}function w(t,e,r,n,a,o){var s=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(T,r,r.active/(r.steps.length-1),o),e.call(m,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:s}),l&&l.method&&a&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:l,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&i.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function M(t,e,r){var i=r.node(),o=n.select(e);function s(){return r.data()[0]}t.on("mousedown",function(){var t=s();e.emit("plotly_sliderstart",{slider:t});var l=r.select("."+c.gripRectClass);n.event.stopPropagation(),n.event.preventDefault(),l.call(a.fill,t.activebgcolor);var u=E(t,n.mouse(i)[0]);_(e,r,t,u,!0),t._dragging=!0,o.on("mousemove",function(){var t=s(),a=E(t,n.mouse(i)[0]);_(e,r,t,a,!1)}),o.on("mouseup",function(){var t=s();t._dragging=!1,l.call(a.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function A(t,e){var r=t.selectAll("rect."+c.tickRectClass).data(e.steps),i=e._dims;r.enter().append("rect").classed(c.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var s=r%i.labelStride==0,l=n.select(this);l.attr({height:s?e.ticklen:e.minorticklen}).call(a.fill,e.tickcolor),o.setTranslate(l,k(e,r/(e.steps.length-1))-.5*e.tickwidth,(s?c.tickOffset:c.minorTickOffset)+i.currentValueTotalHeight)})}function T(t,e,r,n){var i=t.select("rect."+c.gripRectClass),a=k(e,r);if(!e._invokingCommand){var o=i;n&&e.transition.duration>0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*c.gripWidth)+","+e._dims.currentValueTotalHeight+")")}}function k(t,e){var r=t._dims;return r.inputAreaStart+c.stepInset+(r.inputAreaLength-2*c.stepInset)*Math.min(1,Math.max(0,e))}function E(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-c.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*c.stepInset-2*r.inputAreaStart)))}function S(t,e,r){var n=r._dims,i=s.ensureSingle(t,"rect",c.railTouchRectClass,function(n){n.call(M,e,t,r).style("pointer-events","all")});i.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,c.tickOffset+r.ticklen+n.labelHeight)}).call(a.fill,r.bgcolor).attr("opacity",0),o.setTranslate(i,0,n.currentValueTotalHeight)}function L(t,e){var r=e._dims,n=r.inputAreaLength-2*c.railInset,i=s.ensureSingle(t,"rect",c.railRectClass);i.attr({width:n,height:c.railWidth,rx:c.railRadius,ry:c.railRadius,"shape-rendering":"crispEdges"}).call(a.stroke,e.bordercolor).call(a.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(i,c.railInset,.5*(r.inputAreaWidth-c.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[c.name],n=[],i=0;i0?[0]:[]);if(a.enter().append("g").classed(c.containerClassName,!0).style("cursor","ew-resize"),a.exit().remove(),a.exit().size()&&function(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n=r.steps.length&&(r.active=0);e.call(m,r).call(L,r).call(x,r).call(A,r).call(S,t,r).call(y,t,r);var n=r._dims;o.setTranslate(e,n.lx+r.pad.l,n.ly+r.pad.t),e.call(T,r,r.active/(r.steps.length-1),!1),e.call(m,r)}(t,n.select(this),e)}})}}},{"../../constants/alignment":457,"../../lib":481,"../../lib/svg_text_utils":504,"../../plots/plots":568,"../color":357,"../drawing":382,"../legend/anchor_utils":409,"./constants":446,d3:80}],449:[function(t,e,r){"use strict";var n=t("./constants");e.exports={moduleType:"component",name:n.name,layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),draw:t("./draw")}},{"./attributes":445,"./constants":446,"./defaults":447,"./draw":448}],450:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib"),l=t("../drawing"),u=t("../color"),c=t("../../lib/svg_text_utils"),f=t("../../constants/interactions");e.exports={draw:function(t,e,r){var d,p=r.propContainer,g=r.propName,v=r.placeholder,m=r.traceIndex,y=r.avoid||{},b=r.attributes,x=r.transform,_=r.containerGroup,w=t._fullLayout,M=p.titlefont||{},A=M.family,T=M.size,k=M.color,E=1,S=!1,L=(p.title||"").trim();"title"===g?d="titleText":-1!==g.indexOf("axis")?d="axisTitleText":g.indexOf(!0)&&(d="colorbarTitleText");var C=t._context.edits[d];""===L?E=0:L.replace(h," % ")===v.replace(h," % ")&&(E=.2,S=!0,C||(L=""));var P=L||C;_||(_=s.ensureSingle(w._infolayer,"g","g-"+e));var O=_.selectAll("text").data(P?[0]:[]);if(O.enter().append("text"),O.text(L).attr("class",e),O.exit().remove(),!P)return _;function R(t){s.syncOrAsync([I,N],t)}function I(e){var r;return x?(r="",x.rotate&&(r+="rotate("+[x.rotate,b.x,b.y]+")"),x.offset&&(r+="translate(0, "+x.offset+")")):r=null,e.attr("transform",r),e.style({"font-family":A,"font-size":n.round(T,2)+"px",fill:u.rgb(k),opacity:E*u.opacity(k),"font-weight":a.fontWeight}).attr(b).call(c.convertToTspans,t),a.previousPromises(t)}function N(t){var e=n.select(t.node().parentNode);if(y&&y.selection&&y.side&&L){e.attr("transform",null);var r=0,a={left:"right",right:"left",top:"bottom",bottom:"top"}[y.side],o=-1!==["left","top"].indexOf(y.side)?-1:1,u=i(y.pad)?y.pad:2,c=l.bBox(e.node()),f={left:0,top:0,right:w.width,bottom:w.height},h=y.maxShift||(f[y.side]-c[y.side])*("left"===y.side||"top"===y.side?-1:1);if(h<0)r=h;else{var d=y.offsetLeft||0,p=y.offsetTop||0;c.left-=d,c.right-=d,c.top-=p,c.bottom-=p,y.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(r=Math.max(r,o*(t[y.side]-c[a])+u))}),r=Math.min(h,r)}if(r>0||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[y.side];e.attr("transform","translate("+g+")")}}}O.call(R),C&&(L?O.on(".opacity",null):(E=0,S=!0,O.text(v).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})),O.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==m?o.call("restyle",t,g,e,m):o.call("relayout",t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(R)}).on("input",function(t){this.text(t||" ").call(c.positionText,b.x,b.y)}));return O.classed("js-placeholder",S),_}};var h=/ [XY][0-9]* /},{"../../constants/interactions":460,"../../lib":481,"../../lib/svg_text_utils":504,"../../plots/plots":568,"../../registry":577,"../color":357,"../drawing":382,d3:80,"fast-isnumeric":90}],451:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plot_api/edit_types").overrideAll,s=t("../../plots/pad_attributes");e.exports=o({_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:{_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}},x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},pad:a({},s,{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}},"arraydraw","from-root")},{"../../lib/extend":473,"../../plot_api/edit_types":510,"../../plots/font_attributes":551,"../../plots/pad_attributes":567,"../color/attributes":356}],452:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],453:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/array_container_defaults"),a=t("./attributes"),o=t("./constants").name,s=a.buttons;function l(t,e,r){function i(r,i){return n.coerce(t,e,a,r,i)}var o=function(t,e){var r,i,a=t.buttons||[],o=e.buttons=[];function l(t,e){return n.coerce(r,i,s,t,e)}for(var u=0;u0)&&(i("active"),i("direction"),i("type"),i("showactive"),i("x"),i("y"),n.noneOrAll(t,e,["x","y"]),i("xanchor"),i("yanchor"),i("pad.t"),i("pad.r"),i("pad.b"),i("pad.l"),n.coerceFont(i,"font",r.font),i("bgcolor",r.paper_bgcolor),i("bordercolor"),i("borderwidth"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":481,"../../plots/array_container_defaults":521,"./attributes":451,"./constants":452}],454:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plots/plots"),a=t("../color"),o=t("../drawing"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),u=t("../legend/anchor_utils"),c=t("../../constants/alignment").LINE_SPACING,f=t("./constants"),h=t("./scrollbox");function d(t){return t._index}function p(t,e){return+t.attr(f.menuIndexAttrName)===e._index}function g(t,e,r,n,i,a,o,s){e._input.active=e.active=o,"buttons"===e.type?m(t,n,null,null,e):"dropdown"===e.type&&(i.attr(f.menuIndexAttrName,"-1"),v(t,n,i,a,e),s||m(t,n,i,a,e))}function v(t,e,r,n,i){var a=s.ensureSingle(e,"g",f.headerClassName,function(t){t.style("pointer-events","all")}),l=i._dims,u=i.active,c=i.buttons[u]||f.blankHeaderOpts,h={y:i.pad.t,yPad:0,x:i.pad.l,xPad:0,index:0},d={width:l.headerWidth,height:l.headerHeight};a.call(y,i,c,t).call(T,i,h,d),s.ensureSingle(e,"text",f.headerArrowClassName,function(t){t.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,i.font).text(f.arrowSymbol[i.direction])}).attr({x:l.headerWidth-f.arrowOffsetX+i.pad.l,y:l.headerHeight/2+f.textOffsetY+i.pad.t}),a.on("click",function(){r.call(k),r.attr(f.menuIndexAttrName,p(r,i)?-1:String(i._index)),m(t,e,r,n,i)}),a.on("mouseover",function(){a.call(w)}),a.on("mouseout",function(){a.call(M,i)}),o.setTranslate(e,l.lx,l.ly)}function m(t,e,r,a,o){r||(r=e).attr("pointer-events","all");var s=function(t){return-1==+t.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,l="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+l).data(s),c=u.enter().append("g").classed(l,!0),h=u.exit();"dropdown"===o.type?(c.attr("opacity","0").transition().attr("opacity","1"),h.transition().attr("opacity","0").remove()):h.remove();var d=0,p=0,v=o._dims,m=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(m?p=v.headerHeight+f.gapButtonHeader:d=v.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(p=-f.gapButtonHeader+f.gapButton-v.openHeight),"dropdown"===o.type&&"left"===o.direction&&(d=-f.gapButtonHeader+f.gapButton-v.openWidth);var b={x:v.lx+d+o.pad.l,y:v.ly+p+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},x={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each(function(s,l){var c=n.select(this);c.call(y,o,s,t).call(T,o,b),c.on("click",function(){n.event.defaultPrevented||(g(t,o,0,e,r,a,l),s.execute&&i.executeAPICommand(t,s.method,s.args),t.emit("plotly_buttonclicked",{menu:o,button:s,active:o.active}))}),c.on("mouseover",function(){c.call(w)}),c.on("mouseout",function(){c.call(M,o),u.call(_,o)})}),u.call(_,o),m?(x.w=Math.max(v.openWidth,v.headerWidth),x.h=b.y-x.t):(x.w=b.x-x.l,x.h=Math.max(v.openHeight,v.headerHeight)),x.direction=o.direction,a&&(u.size()?function(t,e,r,n,i,a){var o,s,l,u=i.direction,c="up"===u||"down"===u,h=i._dims,d=i.active;if(c)for(s=0,l=0;l0?[0]:[]);if(a.enter().append("g").classed(f.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&function(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;nw,T=s.barLength+2*s.barPad,k=s.barWidth+2*s.barPad,E=p,S=v+m;S+k>u&&(S=u-k);var L=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);L.exit().on(".drag",null).remove(),L.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,s.barColor),A?(this.hbar=L.attr({rx:s.barRadius,ry:s.barRadius,x:E,y:S,width:T,height:k}),this._hbarXMin=E+T/2,this._hbarTranslateMax=w-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var C=m>M,P=s.barWidth+2*s.barPad,O=s.barLength+2*s.barPad,R=p+g,I=v;R+P>l&&(R=l-P);var N=this.container.selectAll("rect.scrollbar-vertical").data(C?[0]:[]);N.exit().on(".drag",null).remove(),N.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,s.barColor),C?(this.vbar=N.attr({rx:s.barRadius,ry:s.barRadius,x:R,y:I,width:P,height:O}),this._vbarYMin=I+O/2,this._vbarTranslateMax=M-O):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var z=this.id,D=c-.5,F=C?f+P+.5:f+.5,j=h-.5,B=A?d+k+.5:d+.5,U=o._topdefs.selectAll("#"+z).data(A||C?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",z).append("rect"),A||C?(this._clipRect=U.select("rect").attr({x:Math.floor(D),y:Math.floor(j),width:Math.ceil(F)-Math.floor(D),height:Math.ceil(B)-Math.floor(j)}),this.container.call(a.setClipUrl,z),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(a.setClipUrl,null),delete this._clipRect),A||C){var V=n.behavior.drag().on("dragstart",function(){n.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var H=n.behavior.drag().on("dragstart",function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(H),C&&this.vbar.on(".drag",null).call(H)}this.setTranslate(e,r)},s.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(a.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},s.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=n.event.dx),this.vbar&&(e-=n.event.dy),this.setTranslate(t,e)},s.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=n.event.deltaY),this.vbar&&(e+=n.event.deltaY),this.setTranslate(t,e)},s.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,i=r+this._hbarTranslateMax;t=(o.constrain(n.event.x,r,i)-r)/(i-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,s=a+this._vbarTranslateMax;e=(o.constrain(n.event.y,a,s)-a)/(s-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},s.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=o.constrain(t||0,0,r),e=o.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(a.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(a.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var s=e/n;this.vbar.call(a.setTranslate,t,e+s*this._vbarTranslateMax)}}},{"../../lib":481,"../color":357,"../drawing":382,d3:80}],457:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},FROM_BR:{left:1,center:.5,right:0,bottom:0,middle:.5,top:1},LINE_SPACING:1.3,MID_SHIFT:.35,OPPOSITE_SIDE:{left:"right",right:"left",top:"bottom",bottom:"top"}}},{}],458:[function(t,e,r){"use strict";e.exports={solid:[[],0],dot:[[.5,1],200],dash:[[.5,1],50],longdash:[[.5,1],10],dashdot:[[.5,.625,.875,1],50],longdashdot:[[.5,.7,.8,1],10]}},{}],459:[function(t,e,r){"use strict";e.exports={circle:"\u25cf","circle-open":"\u25cb",square:"\u25a0","square-open":"\u25a1",diamond:"\u25c6","diamond-open":"\u25c7",cross:"+",x:"\u274c"}},{}],460:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],461:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6,MINUS_SIGN:"\u2212"}},{}],462:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],463:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],464:[function(t,e,r){"use strict";r.version="1.38.3",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config");for(var n=t("./registry"),i=r.register=n.register,a=t("./plot_api"),o=Object.keys(a),s=0;s180&&(t-=360*Math.round(t/360)),t}},{}],467:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),n(t)?Number(t):i}},{"../constants/numerical":461,"fast-isnumeric":90}],468:[function(t,e,r){"use strict";e.exports=function(t){var e=t._fullLayout;e._glcanvas&&e._glcanvas.size()&&e._glcanvas.each(function(t){t.regl&&t.regl.clear({color:!0,depth:!0})})}},{}],469:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=t("./regex").counter,u=t("../constants/interactions").DESELECTDIM,c=t("./angles").wrap180,f=t("./is_array").isArrayOrTypedArray;r.valObjectMeta={data_array:{coerceFunction:function(t,e,r){f(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;ni.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;!0!==n.strict&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every(function(t){return i(t).isValid()})?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(o(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?e.set(c(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r,n){var i=n.regex||l(r);"string"==typeof t&&i.test(t)?e.set(t):e.set(r)},validateFunction:function(t,e){var r=e.dflt;return t===r||"string"==typeof t&&!!l(r).test(t)}},flaglist:{coerceFunction:function(t,e,r,n){if("string"==typeof t)if(-1===(n.extras||[]).indexOf(t)){for(var i=t.split("+"),a=0;a=n&&t<=i?t:c;if("string"!=typeof t&&"number"!=typeof t)return c;t=String(t);var a=_(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var s=a&&"chinese"===e.substr(0,7),l=t.match(s?b:y);if(!l)return c;var u=l[1],m=l[3]||"1",w=Number(l[5]||1),M=Number(l[7]||0),A=Number(l[9]||0),T=Number(l[11]||0);if(a){if(2===u.length)return c;var k;u=Number(u);try{var E=v.getComponentMethod("calendars","getCal")(e);if(s){var S="i"===m.charAt(m.length-1);m=parseInt(m,10),k=E.newDate(u,E.toMonthIndex(u,m,S),w)}else k=E.newDate(u,Number(m),w)}catch(t){return c}return k?(k.toJD()-g)*f+M*h+A*d+T*p:c}u=2===u.length?(Number(u)+2e3-x)%100+x:Number(u),m-=1;var L=new Date(Date.UTC(2e3,m,w,M,A));return L.setUTCFullYear(u),L.getUTCMonth()!==m?c:L.getUTCDate()!==w?c:L.getTime()+T*p},n=r.MIN_MS=r.dateTime2ms("-9999"),i=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==c};var M=90*f,A=3*h,T=5*d;function k(t,e,r,n,i){if((e||r||n||i)&&(t+=" "+w(e,2)+":"+w(r,2),(n||i)&&(t+=":"+w(n,2),i))){for(var a=4;i%10==0;)a-=1,i/=10;t+="."+w(i,a)}return t}r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=n&&t<=i))return c;e||(e=0);var a,o,s,u,y,b,x=Math.floor(10*l(t+.05,1)),w=Math.round(t-x/10);if(_(r)){var E=Math.floor(w/f)+g,S=Math.floor(l(t,f));try{a=v.getComponentMethod("calendars","getCal")(r).fromJD(E).formatDate("yyyy-mm-dd")}catch(t){a=m("G%Y-%m-%d")(new Date(w))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;o=e=n+f&&t<=i-f))return c;var e=Math.floor(10*l(t+.05,1)),r=new Date(Math.round(t-e/10));return k(a.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,n){if(r.isJSDate(t)||"number"==typeof t){if(_(n))return s.error("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,n))return s.error("unrecognized date",t),e;return t};var E=/%\d?f/g;function S(t,e,r,n){t=t.replace(E,function(t){var r=Math.min(+t.charAt(1)||6,6);return(e/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"});var i=new Date(Math.floor(e+.05));if(_(n))try{t=v.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(i)}var L=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(t,e,r,n,i,a){if(i=_(i)&&i,!e)if("y"===r)e=a.year;else if("m"===r)e=a.month;else{if("d"!==r)return function(t,e){var r=l(t+.05,f),n=w(Math.floor(r/h),2)+":"+w(l(Math.floor(r/d),60),2);if("M"!==e){o(e)||(e=0);var i=(100+Math.min(l(t/p,60),L[e])).toFixed(e).substr(1);e>0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}(t,r)+"\n"+S(a.dayMonthYear,t,n,i);e=a.dayMonth+"\n"+a.year}return S(e,t,n,i)};var C=3*f;r.incrementMonth=function(t,e,r){r=_(r)&&r;var n=l(t,f);if(t=Math.round(t-n),r)try{var i=Math.round(t/f)+g,a=v.getComponentMethod("calendars","getCal")(r),o=a.fromJD(i);return e%12?a.add(o,e,"m"):a.add(o,e/12,"y"),(o.toJD()-g)*f+n}catch(e){s.error("invalid ms "+t+" in calendar "+r)}var u=new Date(t+C);return u.setUTCMonth(u.getUTCMonth()+e)+n-C},r.findExactDates=function(t,e){for(var r,n,i=0,a=0,s=0,l=0,u=_(e)&&v.getComponentMethod("calendars","getCal")(e),c=0;c1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}function l(t,e,r,n,i){var a=n*t+i*e;if(a<0)return n*n+i*i;if(a>r){var o=n-t,s=i-e;return o*o+s*s}var l=n*e-i*t;return l*l/r}r.segmentsIntersect=s,r.segmentDistance=function(t,e,r,n,i,a,o,u){if(s(t,e,r,n,i,a,o,u))return 0;var c=r-t,f=n-e,h=o-i,d=u-a,p=c*c+f*f,g=h*h+d*d,v=Math.min(l(c,f,p,i-t,a-e),l(c,f,p,o-t,u-e),l(h,d,g,t-i,e-a),l(h,d,g,r-i,n-a));return Math.sqrt(v)},r.getTextLocation=function(t,e,r,s){if(t===i&&s===a||(n={},i=t,a=s),n[r])return n[r];var l=t.getPointAtLength(o(r-s/2,e)),u=t.getPointAtLength(o(r+s/2,e)),c=Math.atan((u.y-l.y)/(u.x-l.x)),f=t.getPointAtLength(o(r,e)),h={x:(4*f.x+l.x+u.x)/6,y:(4*f.y+l.y+u.y)/6,theta:c};return n[r]=h,h},r.clearLocationCache=function(){i=null},r.getVisibleSegment=function(t,e,r){var n,i,a=e.left,o=e.right,s=e.top,l=e.bottom,u=0,c=t.getTotalLength(),f=c;function h(e){var r=t.getPointAtLength(e);0===e?n=r:e===c&&(i=r);var u=r.xo?r.x-o:0,f=r.yl?r.y-l:0;return Math.sqrt(u*u+f*f)}for(var d=h(u);d;){if((u+=d+r)>f)return;d=h(u)}for(d=h(f);d;){if(u>(f-=d+r))return;d=h(f)}return{min:u,max:f,len:f-u,total:c,isClosed:0===u&&f===c&&Math.abs(n.x-i.x)<.1&&Math.abs(n.y-i.y)<.1}},r.findPointOnPath=function(t,e,r,n){for(var i,a,o,s=(n=n||{}).pathLength||t.getTotalLength(),l=n.tolerance||.001,u=n.iterationLimit||30,c=t.getPointAtLength(0)[r]>t.getPointAtLength(s)[r]?-1:1,f=0,h=0,d=s;f0?d=i:h=i,f++}return a}},{"./mod":488}],477:[function(t,e,r){"use strict";e.exports=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null==t)throw new Error("DOM element provided is null or undefined");return t}},{}],478:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("color-normalize"),o=t("../components/colorscale"),s=t("../components/color/attributes").defaultLine,l=t("./is_array").isArrayOrTypedArray,u=a(s),c=1;function f(t,e){var r=t;return r[3]*=e,r}function h(t){if(n(t))return u;var e=a(t);return e.length?e:u}function d(t){return n(t)?t:c}e.exports={formatColor:function(t,e,r){var n,i,s,p,g,v=t.color,m=l(v),y=l(e),b=[];if(n=void 0!==t.colorscale?o.makeColorScaleFunc(o.extractScale(t.colorscale,t.cmin,t.cmax)):h,i=m?function(t,e){return void 0===t[e]?u:a(n(t[e]))}:h,s=y?function(t,e){return void 0===t[e]?c:d(t[e])}:d,m||y)for(var x=0;x=0;){var n=t.indexOf(";",r);if(n/g,"")}(function(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n"))))}},{"../constants/string_mappings":462,"superscript-text":320}],480:[function(t,e,r){"use strict";e.exports=function(t){return t}},{}],481:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../constants/numerical"),o=a.FP_SAFE,s=a.BADNUM,l=e.exports={};l.nestedProperty=t("./nested_property"),l.keyedContainer=t("./keyed_container"),l.relativeAttr=t("./relative_attr"),l.isPlainObject=t("./is_plain_object"),l.mod=t("./mod"),l.toLogRange=t("./to_log_range"),l.relinkPrivateKeys=t("./relink_private"),l.ensureArray=t("./ensure_array");var u=t("./is_array");l.isTypedArray=u.isTypedArray,l.isArrayOrTypedArray=u.isArrayOrTypedArray,l.isArray1D=u.isArray1D;var c=t("./coerce");l.valObjectMeta=c.valObjectMeta,l.coerce=c.coerce,l.coerce2=c.coerce2,l.coerceFont=c.coerceFont,l.coerceHoverinfo=c.coerceHoverinfo,l.coerceSelectionMarkerOpacity=c.coerceSelectionMarkerOpacity,l.validate=c.validate;var f=t("./dates");l.dateTime2ms=f.dateTime2ms,l.isDateTime=f.isDateTime,l.ms2DateTime=f.ms2DateTime,l.ms2DateTimeLocal=f.ms2DateTimeLocal,l.cleanDate=f.cleanDate,l.isJSDate=f.isJSDate,l.formatDate=f.formatDate,l.incrementMonth=f.incrementMonth,l.dateTick0=f.dateTick0,l.dfltRange=f.dfltRange,l.findExactDates=f.findExactDates,l.MIN_MS=f.MIN_MS,l.MAX_MS=f.MAX_MS;var h=t("./search");l.findBin=h.findBin,l.sorterAsc=h.sorterAsc,l.sorterDes=h.sorterDes,l.distinctVals=h.distinctVals,l.roundUp=h.roundUp;var d=t("./stats");l.aggNums=d.aggNums,l.len=d.len,l.mean=d.mean,l.midRange=d.midRange,l.variance=d.variance,l.stdev=d.stdev,l.interp=d.interp;var p=t("./matrix");l.init2dArray=p.init2dArray,l.transposeRagged=p.transposeRagged,l.dot=p.dot,l.translationMatrix=p.translationMatrix,l.rotationMatrix=p.rotationMatrix,l.rotationXYMatrix=p.rotationXYMatrix,l.apply2DTransform=p.apply2DTransform,l.apply2DTransform2=p.apply2DTransform2;var g=t("./angles");l.deg2rad=g.deg2rad,l.rad2deg=g.rad2deg,l.wrap360=g.wrap360,l.wrap180=g.wrap180;var v=t("./geometry2d");l.segmentsIntersect=v.segmentsIntersect,l.segmentDistance=v.segmentDistance,l.getTextLocation=v.getTextLocation,l.clearLocationCache=v.clearLocationCache,l.getVisibleSegment=v.getVisibleSegment,l.findPointOnPath=v.findPointOnPath;var m=t("./extend");l.extendFlat=m.extendFlat,l.extendDeep=m.extendDeep,l.extendDeepAll=m.extendDeepAll,l.extendDeepNoArrays=m.extendDeepNoArrays;var y=t("./loggers");l.log=y.log,l.warn=y.warn,l.error=y.error;var b=t("./regex");l.counterRegex=b.counter;var x=t("./throttle");function _(t){var e={};for(var r in t)for(var n=t[r],i=0;io?s:i(t)?Number(t):s:s},l.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(i(t)&&t>=0&&t%1==0)},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var i=0;ir?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},l.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={optionList:[],_newoption:function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)}};return r["_"+e]=t,r},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;r=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[n];c[r]=a}return c},l.syncOrAsync=function(t,e,r){var n;function i(){return l.syncOrAsync(t,e,r)}for(;t.length;)if((n=(0,t.splice(0,1)[0])(e))&&n.then)return n.then(i).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,i=!1,a=!0;for(n=0;n1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l};var A=/%{([^\s%{}]*)}/g,T=/^\w*$/;l.templateString=function(t,e){var r={};return t.replace(A,function(t,n){return T.test(n)?e[n]||"":(r[n]=r[n]||l.nestedProperty(e,n).get,r[n]()||"")})};l.subplotSort=function(t,e){for(var r=Math.min(t.length,e.length)+1,n=0,i=0,a=0;a=48&&o<=57,u=s>=48&&s<=57;if(l&&(n=10*n+o-48),u&&(i=10*i+s-48),!l||!u){if(n!==i)return n-i;if(o!==s)return o-s}}return i-n};var k=2e9;l.seedPseudoRandom=function(){k=2e9},l.pseudoRandom=function(){var t=k;return k=(69069*k+1)%4294967296,Math.abs(k-t)<429496729?l.pseudoRandom():k/4294967296}},{"../constants/numerical":461,"./angles":466,"./clean_number":467,"./coerce":469,"./dates":470,"./ensure_array":471,"./extend":473,"./filter_unique":474,"./filter_visible":475,"./geometry2d":476,"./get_graph_div":477,"./identity":480,"./is_array":482,"./is_plain_object":483,"./keyed_container":484,"./localize":485,"./loggers":486,"./matrix":487,"./mod":488,"./nested_property":489,"./noop":490,"./notifier":491,"./push_unique":494,"./regex":496,"./relative_attr":497,"./relink_private":498,"./search":499,"./stats":502,"./throttle":505,"./to_log_range":506,d3:80,"fast-isnumeric":90}],482:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function a(t){return n.isView(t)&&!(t instanceof i)}function o(t){return Array.isArray(t)||a(t)}e.exports={isTypedArray:a,isArrayOrTypedArray:o,isArray1D:function(t){return!o(t[0])}}},{}],483:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],484:[function(t,e,r){"use strict";var n=t("./nested_property"),i=/^\w*$/;e.exports=function(t,e,r,a){var o,s,l;r=r||"name",a=a||"value";var u={};e&&e.length?(l=n(t,e),s=l.get()):s=t,e=e||"";var c={};if(s)for(o=0;o2)return u[e]=2|u[e],h.set(t,null);if(f){for(o=e;o1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e/g),o=0;oo||a===i||al||e&&u(t))}:function(t,e){var a=t[0],u=t[1];if(a===i||ao||u===i||ul)return!1;var c,f,h,d,p,g=r.length,v=r[0][0],m=r[0][1],y=0;for(c=1;cMath.max(f,v)||u>Math.max(h,m)))if(uc||Math.abs(n(o,h))>i)return!0;return!1};a.filter=function(t,e){var r=[t[0]],n=0,i=0;function a(a){t.push(a);var s=r.length,l=n;r.splice(i+1);for(var u=l+1;u1&&a(t.pop());return{addPt:a,raw:t,filtered:r}}},{"../constants/numerical":461,"./matrix":487}],494:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ri.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--))},startSequence:function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},stopSequence:function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},undo:function(t){var e,r;if(t.framework&&t.framework.isPolar)t.framework.undo();else if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function l(t,e){return t>=e}r.findBin=function(t,e,r){if(n(e.start))return r?Math.ceil((t-e.start)/e.size-1e-9)-1:Math.floor((t-e.start)/e.size+1e-9);var u,c,f=0,h=e.length,d=0,p=h>1?(e[h-1]-e[0])/(h-1):1;for(c=p>=0?r?a:o:r?l:s,t+=1e-9*p*(r?-1:1)*(p>=0?1:-1);f90&&i.log("Long binary search..."),f-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,a=i/(n||1)/1e4,o=[e[0]],s=0;se[s]+a&&(i=Math.min(i,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;ia.length)&&(o=a.length),n(e)||(e=!1),i(a[0])){for(l=new Array(o),s=0;st.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"./is_array":482,"fast-isnumeric":90}],503:[function(t,e,r){"use strict";var n=t("color-normalize");e.exports=function(t){return t?n(t):[0,0,0,1]}},{"color-normalize":61}],504:[function(t,e,r){"use strict";var n=t("d3"),i=t("../lib"),a=t("../constants/xmlns_namespaces"),o=t("../constants/string_mappings"),s=t("../constants/alignment").LINE_SPACING;function l(t,e){return t.node().getBoundingClientRect()[e]}var u=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,o){var m=t.text(),L=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&m.match(u),C=n.select(t.node().parentNode);if(!C.empty()){var P=t.attr("class")?t.attr("class").split(" ")[0]:"text";return P+="-math",C.selectAll("svg."+P).remove(),C.selectAll("g."+P+"-group").remove(),t.style("display",null).attr({"data-unformatted":m,"data-math":"N"}),L?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),a={fontSize:r};!function(t,e,r){var a="math-output-"+i.randstr([],64),o=n.select("body").append("div").attr({id:a}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text((s=t,s.replace(c,"\\lt ").replace(f,"\\gt ")));var s;MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=n.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())i.log("There was an error in the tex syntax.",t),r();else{var a=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,a)}o.remove()})}(L[2],a,function(n,i,a){C.selectAll("svg."+P).remove(),C.selectAll("g."+P+"-group").remove();var s=n&&n.select("svg");if(!s||!s.node())return O(),void e();var u=C.append("g").classed(P+"-group",!0).attr({"pointer-events":"none","data-unformatted":m,"data-math":"Y"});u.node().appendChild(s.node()),i&&i.node()&&s.node().insertBefore(i.node().cloneNode(!0),s.node().firstChild),s.attr({class:P,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=t.node().style.fill||"black";s.select("g").attr({fill:c,stroke:c});var f=l(s,"width"),h=l(s,"height"),d=+t.attr("x")-f*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],p=-(r||l(t,"height"))/4;"y"===P[0]?(u.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-f/2,p-h/2]+")"}),s.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===P[0]?s.attr({x:t.attr("x"),y:p-h/2}):"a"===P[0]?s.attr({x:0,y:p}):s.attr({x:d,y:+t.attr("y")+p-h/2}),o&&o.call(t,u),e(u)})})):O(),t}function O(){C.empty()||(P=t.attr("class")+"-math",C.select("svg."+P).remove()),t.text("").style("white-space","pre"),function(t,e){e=(r=e,function(t,e){if(!t)return"";for(var r=0;r1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),o=u[u.length-1].node}else i.log("Ignoring unexpected end tag .",e)}w.test(e)?f():(o=t,u=[{node:t}]);for(var P=e.split(x),O=0;O|>|>)/g;var h={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},d={sub:"0.3em",sup:"-0.6em"},p={sub:"-0.21em",sup:"0.42em"},g="\u200b",v=["http:","https:","mailto:","",void 0,":"],m=new RegExp("]*)?/?>","g"),y=Object.keys(o.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:o.entityToUnicode[t]}}),b=/(\r\n?|\n)/g,x=/(<[^<>]*>)/,_=/<(\/?)([^ >]*)(\s+(.*))?>/i,w=//i,M=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,A=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,T=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,k=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function E(t,e){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}var S=/(^|;)\s*color:/;function L(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-n.width}:"center"===o?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}r.plainText=function(t){return(t||"").replace(m," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){var t=n.select(this);function i(e,r){return void 0===r?null===(r=t.attr(e))&&(t.attr(e,0),r=0):t.attr(e,r),r}var a=i("x",e),o=i("y",r);"text"===this.nodeName&&t.selectAll("tspan.line").attr({x:a,y:o})})},r.makeEditable=function(t,e){var r=e.gd,i=e.delegate,a=n.dispatch("edit","input","cancel"),o=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");function s(){!function(){var i=n.select(r).select(".svg-container"),o=i.append("div"),s=t.node().style,u=parseFloat(s.fontSize||12),c=e.text;void 0===c&&(c=t.attr("data-unformatted"));o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":s.fontFamily||"Arial","font-size":u,color:e.fill||s.fill||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-u/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(c).call(L(t,i,e)).on("blur",function(){r._editing=!1,t.text(this.textContent).style({opacity:1});var e,i=n.select(this).attr("class");(e=i?"."+i.split(" ")[0]+"-math-group":"[class*=-math-group]")&&n.select(t.node().parentNode).select(e).style({opacity:0});var o=this.textContent;n.select(this).transition().duration(0).remove(),n.select(document).on("mouseup",null),a.edit.call(t,o)}).on("focus",function(){var t=this;r._editing=!0,n.select(document).on("mouseup",function(){if(n.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===n.event.which?(r._editing=!1,t.style({opacity:1}),n.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),a.cancel.call(t,this.textContent)):(a.input.call(t,this.textContent),n.select(this).call(L(t,i,e)))}).on("keydown",function(){13===n.event.which&&this.blur()}).call(l)}(),t.style({opacity:0});var i,s=o.attr("class");(i=s?"."+s.split(" ")[0]+"-math-group":"[class*=-math-group]")&&n.select(t.node().parentNode).select(i).style({opacity:0})}function l(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}return e.immediate?s():o.on("click",s),n.rebind(t,a,"on")}},{"../constants/alignment":457,"../constants/string_mappings":462,"../constants/xmlns_namespaces":463,"../lib":481,d3:80}],505:[function(t,e,r){"use strict";var n={};function i(t){t&&null!==t.timer&&(clearTimeout(t.timer),t.timer=null)}r.throttle=function(t,e,r){var a=n[t],o=Date.now();if(!a){for(var s in n)n[s].tsa.ts+e?l():a.timer=setTimeout(function(){l(),a.timer=null},e)},r.done=function(t){var e=n[t];return e&&e.timer?new Promise(function(t){var r=e.onDone;e.onDone=function(){r&&r(),t(),e.onDone=null}}):Promise.resolve()},r.clear=function(t){if(t)i(n[t]),delete n[t];else for(var e in n)r.clear(e)}},{}],506:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":90}],507:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],508:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en",dictionary:{"Click to enter Colorscale title":"Click to enter Colourscale title"},format:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],periods:["AM","PM"],dateTime:"%a %b %e %X %Y",date:"%d/%m/%Y",time:"%H:%M:%S",decimal:".",thousands:",",grouping:[3],currency:["$",""],year:"%Y",month:"%b %Y",dayMonth:"%b %-d",dayMonthYear:"%b %-d, %Y"}}},{}],509:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,i=n.layoutArrayContainers,a=n.layoutArrayRegexes,o=t.split("[")[0],s=0;s0&&o.log("Clearing previous rejected promises from queue."),t._promises=[]},r.cleanLayout=function(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var n=(s.subplotsRegistry.cartesian||{}).attrRegex,a=(s.subplotsRegistry.gl3d||{}).attrRegex,l=Object.keys(t);for(e=0;e3?(k.x=1.02,k.xanchor="left"):k.x<-2&&(k.x=-.02,k.xanchor="right"),k.y>3?(k.y=1.02,k.yanchor="bottom"):k.y<-2&&(k.y=-.02,k.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),f.clean(t),t},r.cleanData=function(t,e){for(var n=[],i=t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid}),l=0;l0)return t.substr(0,e)}r.hasParent=function(t,e){for(var r=y(e);r;){if(r in t)return!0;r=y(r)}return!1};var b=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(v,m),d(t),!0)}var b,x,_,w,M,A,T,k=Object.keys(r).map(Number).sort(s),E=e.get(),S=E||[],L=n(m,f).get(),C=[],P=-1,O=S.length;for(b=0;bS.length-(T?0:1))o.warn("index out of range",f,_);else if(void 0!==A)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(A)?C.push(_):T?("add"===A&&(A={}),S.splice(_,0,A),L&&L.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,A),-1===P&&(P=_);else for(x=0;x=0;b--)S.splice(C[b],1),L&&L.splice(C[b],1);if(S.length?E||e.set(S):e.set(null),g)return!1;if(h(v,m),p!==a){var R;if(-1===P)R=k;else{for(O=Math.max(S.length,O),R=[],b=0;b=P);b++)R.push(_);for(b=P;b=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||i<0&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function P(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),C(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&C(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function O(t,e,r,n,a){!function(t,e,r,n){var i=o.isPlainObject(n);if(!Array.isArray(t.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(e))throw new Error("update must be a key:value object");if(void 0===r)throw new Error("indices must be an integer or array of integers");for(var a in C(t,r,"indices"),e){if(!Array.isArray(e[a])||e[a].length!==r.length)throw new Error("attribute "+a+" must be an array of length equal to indices array length");if(i&&(!(a in n)||!Array.isArray(n[a])||n[a].length!==e[a].length))throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object")}}(t,e,r,n);for(var s=function(t,e,r,n){var a,s,l,u,c,f=o.isPlainObject(n),h=[];for(var d in Array.isArray(r)||(r=[r]),r=L(r,t.data.length-1),e)for(var p=0;p=0&&r=0&&r0&&"string"!=typeof L.parts[P];)P--;var O=L.parts[P],R=L.parts[P-1]+"."+O,N=L.parts.slice(0,P).join("."),j=o.nestedProperty(t.layout,N).get(),V=o.nestedProperty(s,N).get(),H=L.get();if(void 0!==C){y[S]=C,b[S]="reverse"===O?C:I(H);var q=c.getLayoutValObject(s,L.parts);if(q&&q.impliedEdits&&null!==C)for(var G in q.impliedEdits)w(o.relativeAttr(S,G),q.impliedEdits[G]);if(-1!==["width","height"].indexOf(S)&&null===C)s[S]=t._initialAutoSize[S];else if(R.match(z))E(R),o.nestedProperty(s,N+"._inputRange").set(null);else if(R.match(D)){E(R),o.nestedProperty(s,N+"._inputRange").set(null);var X=o.nestedProperty(s,N).get();X._inputDomain&&(X._input.domain=X._inputDomain.slice())}else R.match(F)&&o.nestedProperty(s,N+"._inputDomain").set(null);if("type"===O){var W=j,Y="linear"===V.type&&"log"===C,Z="log"===V.type&&"linear"===C;if(Y||Z){if(W&&W.range)if(V.autorange)Y&&(W.range=W.range[1]>W.range[0]?[1,2]:[2,1]);else{var Q=W.range[0],J=W.range[1];Y?(Q<=0&&J<=0&&w(N+".autorange",!0),Q<=0?Q=J/1e6:J<=0&&(J=Q/1e6),w(N+".range[0]",Math.log(Q)/Math.LN10),w(N+".range[1]",Math.log(J)/Math.LN10)):(w(N+".range[0]",Math.pow(10,Q)),w(N+".range[1]",Math.pow(10,J)))}else w(N+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[L.parts[0]]&&"radialaxis"===L.parts[1]&&delete s[L.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(t,V,C,w),u.getComponentMethod("images","convertCoords")(t,V,C,w)}else w(N+".autorange",!0),w(N+".range",null);o.nestedProperty(s,N+"._inputRange").set(null)}else if(O.match(A)){var K=o.nestedProperty(s,S).get(),$=(C||{}).type;$&&"-"!==$||($="linear"),u.getComponentMethod("annotations","convertCoords")(t,K,$,w),u.getComponentMethod("images","convertCoords")(t,K,$,w)}var tt=x.containerArrayMatch(S);if(tt){r=tt.array,n=tt.index;var et=tt.property,rt=(o.nestedProperty(a,r)||[])[n]||{},nt=rt,it=q||{editType:"calc"},at=-1!==it.editType.indexOf("calcIfAutorange");""===n?(at?m.calc=!0:M.update(m,it),at=!1):""===et&&(nt=C,x.isAddVal(C)?b[S]=null:x.isRemoveVal(C)?(b[S]=rt,nt=rt):o.warn("unrecognized full object value",e)),at&&(U(t,nt,"x")||U(t,nt,"y"))?m.calc=!0:M.update(m,it),h[r]||(h[r]={});var ot=h[r][n];ot||(ot=h[r][n]={}),ot[et]=C,delete e[S]}else"reverse"===O?(j.range?j.range.reverse():(w(N+".autorange",!0),j.range=[1,0]),V.autorange?m.calc=!0:m.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===S&&("lasso"===C||"select"===C)&&"lasso"!==H&&"select"!==H?m.plot=!0:q?M.update(m,q):m.calc=!0,L.set(C))}}for(r in h){x.applyContainerArrayChanges(t,o.nestedProperty(a,r),h[r],m)||(m.plot=!0)}var st=s._axisConstraintGroups||[];for(T in k)for(n=0;n=i.length?i[0]:i[t]:i}function l(t){return Array.isArray(a)?t>=a.length?a[0]:a[t]:a}function u(t,e){var r=0;return function(){if(t&&++r===e)return t()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise(function(a,c){function h(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var e=n._currentFrame=n._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=e.frameOpts.duration,f.transition(t,e.frame.data,e.frame.layout,_.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else t.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function d(){t.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var e=function(){n._animationRaf=window.requestAnimationFrame(e),Date.now()-n._lastFrameAt>n._timeToNext&&h()};e()}var p,g,v=0;function m(t){return Array.isArray(i)?v>=i.length?t.transitionOpts=i[v]:t.transitionOpts=i[0]:t.transitionOpts=i,v++,t}var y=[],b=null==e,x=Array.isArray(e);if(!b&&!x&&o.isPlainObject(e))y.push({type:"object",data:m(o.extendFlat({},e))});else if(b||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&AA)&&T.push(g);y=T}}y.length>0?function(e){if(0!==e.length){for(var i=0;i=0;n--)if(o.isPlainObject(e[n])){var g=e[n].name,v=(c[g]||p[g]||{}).name,m=e[n].name,y=c[v]||p[v];v&&m&&"number"==typeof m&&y&&T<5&&(T++,o.warn('addFrames: overwriting frame "'+(c[v]||p[v]).name+'" with a frame whose name of type "number" also equates to "'+v+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===T&&o.warn("addFrames: This API call has yielded too many of these warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),p[g]={name:g},d.push({frame:f.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:h+n})}d.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(i=d[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!i.name)for(;c[i.name="frame "+t._transitionData._counter++];);if(c[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),s.unshift({type:"insert",index:n,value:i[n]});var u=f.modifyFrames,c=f.modifyFrames,h=[t,s],d=[t,a];return l&&l.add(t,u,h,c,d),f.modifyFrames(t,a)},r.purge=function(t){var e=(t=o.getGraphDiv(t))._fullLayout||{},r=t._fullData||[],n=t.calcdata||[];return f.cleanPlot([],{},r,e,n),f.purge(t),s.purge(t),e._container&&e._container.remove(),delete t._context,t}},{"../components/color":357,"../components/drawing":382,"../constants/xmlns_namespaces":463,"../lib":481,"../lib/events":472,"../lib/queue":495,"../lib/svg_text_utils":504,"../plots/cartesian/axes":525,"../plots/cartesian/constants":530,"../plots/cartesian/graph_interact":534,"../plots/plots":568,"../plots/polar/legacy":571,"../registry":577,"./edit_types":510,"./helpers":511,"./manage_arrays":513,"./plot_config":515,"./plot_schema":516,"./subroutines":517,d3:80,"fast-isnumeric":90,"has-hover":231}],515:[function(t,e,r){"use strict";e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,toImageButtonOptions:{},displaylogo:!0,plotGlPixelRatio:2,setBackground:"transparent",topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:1,globalTransforms:[],locale:"en-US",locales:{}}},{}],516:[function(t,e,r){"use strict";var n=t("../registry"),i=t("../lib"),a=t("../plots/attributes"),o=t("../plots/layout_attributes"),s=t("../plots/frame_attributes"),l=t("../plots/animation_attributes"),u=t("../plots/polar/legacy/area_attributes"),c=t("../plots/polar/legacy/axis_attributes"),f=t("./edit_types"),h=i.extendFlat,d=i.extendDeepAll,p=i.isPlainObject,g="_isSubplotObj",v="_isLinkedToArray",m=[g,v,"_arrayAttrRegexps","_deprecated"];function y(t,e,r){if(!t)return!1;if(t._isLinkedToArray)if(b(e[r]))r++;else if(r=a.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!b(o))return!1;t=a[i][o]}else t=a[i]}else t=a}}return t}function b(t){return t===Math.round(t)&&t>=0}function x(t){return function(t){r.crawl(t,function(t,e,n){r.isValObject(t)?"data_array"===t.valType?(t.role="data",n[e+"src"]={valType:"string",editType:"none"}):!0===t.arrayOk&&(n[e+"src"]={valType:"string",editType:"none"}):p(t)&&(t.role="object")})}(t),function(t){r.crawl(t,function(t,e,r){if(!t)return;var n=t[v];if(!n)return;delete t[v],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"})}(t),function(t){!function t(e){for(var r in e)if(p(e[r]))t(e[r]);else if(Array.isArray(e[r]))for(var n=0;n=l.length)return!1;i=(r=(n.transformsRegistry[l[c].type]||{}).attributes)&&r[e[2]],s=3}else if("area"===t.type)i=u[o];else{var f=t._module;if(f||(f=(n.modules[t.type||a.type.dflt]||{})._module),!f)return!1;if(!(i=(r=f.attributes)&&r[o])){var h=f.basePlotModule;h&&h.attributes&&(i=h.attributes[o])}i||(i=a[o])}return y(i,e,s)},r.getLayoutValObject=function(t,e){return y(function(t,e){var r,i,a,s,l=t._basePlotModules;if(l){var u;for(r=0;r=t[1]||i[1]<=t[0])&&a[0]e[0])return!0}return!1}(r,n,M)){var s=a.node(),l=e.bg=o.ensureSingle(a,"rect","bg");s.insertBefore(l.node(),s.childNodes[0])}else a.select("rect.bg").remove(),w.push(t),M.push([r,n])});var A=i._bgLayer.selectAll(".bg").data(w);return A.enter().append("rect").classed("bg",!0),A.exit().remove(),A.each(function(t){i._plots[t].bg=n.select(this)}),x.each(function(t){var e=i._plots[t],r=e.xaxis,n=e.yaxis;e.bg&&p&&e.bg.call(u.setRect,r._offset-s,n._offset-s,r._length+2*s,n._length+2*s).call(l.fill,i.plot_bgcolor).style("stroke-width",0);var a,f,h=e.clipId="clip"+i._uid+t+"plot",d=o.ensureSingleById(i._clips,"clipPath",h,function(t){t.classed("plotclip",!0).append("rect")});if(e.clipRect=d.select("rect").attr({width:r._length,height:n._length}),u.setTranslate(e.plot,r._offset,n._offset),e._hasClipOnAxisFalse?(a=null,f=h):(a=h,f=null),u.setClipUrl(e.plot,a),e.layerClipId=f,p){var v,m,y,x,w,M,A,T,k,E,S,L,C,P="M0,0";b(r,t)&&(w=_(r,"left",n,c),v=r._offset-(w?s+w:0),M=_(r,"right",n,c),m=r._offset+r._length+(M?s+M:0),y=g(r,n,"bottom"),x=g(r,n,"top"),(C=!r._anchorAxis||t!==r._mainSubplot)&&r.ticks&&"allticks"===r.mirror&&(r._linepositions[t]=[y,x]),P=N(r,R,function(t){return"M"+r._offset+","+t+"h"+r._length}),C&&r.showline&&("all"===r.mirror||"allticks"===r.mirror)&&(P+=R(y)+R(x)),e.xlines.style("stroke-width",r._lw+"px").call(l.stroke,r.showline?r.linecolor:"rgba(0,0,0,0)")),e.xlines.attr("d",P);var O="M0,0";b(n,t)&&(S=_(n,"bottom",r,c),A=n._offset+n._length+(S?s:0),L=_(n,"top",r,c),T=n._offset-(L?s:0),k=g(n,r,"left"),E=g(n,r,"right"),(C=!n._anchorAxis||t!==r._mainSubplot)&&n.ticks&&"allticks"===n.mirror&&(n._linepositions[t]=[k,E]),O=N(n,I,function(t){return"M"+t+","+n._offset+"v"+n._length}),C&&n.showline&&("all"===n.mirror||"allticks"===n.mirror)&&(O+=I(k)+I(E)),e.ylines.style("stroke-width",n._lw+"px").call(l.stroke,n.showline?n.linecolor:"rgba(0,0,0,0)")),e.ylines.attr("d",O)}function R(t){return"M"+v+","+t+"H"+m}function I(t){return"M"+t+","+T+"V"+A}function N(e,r,n){if(!e.showline||t!==e._mainSubplot)return"";if(!e._anchorAxis)return n(e._mainLinePosition);var i=r(e._mainLinePosition);return e.mirror&&(i+=r(e._mainMirrorPosition)),i}}),h.makeClipPaths(t),r.drawMainTitle(t),f.manage(t),t._promises.length&&Promise.all(t._promises)},r.drawMainTitle=function(t){var e=t._fullLayout;c.draw(t,"gtitle",{propContainer:e,propName:"title",placeholder:e._dfltTitle.plot,attributes:{x:e.width/2,y:e._size.t/2,"text-anchor":"middle"}})},r.doTraceStyle=function(t){for(var e=0;eb.length&&i.push(d("unused",a,m.concat(b.length)));var A,T,k,E,S,L=b.length,C=Array.isArray(M);if(C&&(L=Math.min(L,M.length)),2===x.dimensions)for(T=0;Tb[T].length&&i.push(d("unused",a,m.concat(T,b[T].length)));var P=b[T].length;for(A=0;A<(C?Math.min(P,M[T].length):P);A++)k=C?M[T][A]:M,E=y[T][A],S=b[T][A],n.validate(E,k)?S!==E&&S!==+E&&i.push(d("dynamic",a,m.concat(T,A),E,S)):i.push(d("value",a,m.concat(T,A),E))}else i.push(d("array",a,m.concat(T),y[T]));else for(T=0;T1&&h.push(d("object","layout"))),i.supplyDefaults(p);for(var g=p._fullData,v=r.length,m=0;m0&&u>0&&c/u>p&&(o=n,l=a,p=c/u);if(h===d){var y=h-1,b=h+1;f="tozero"===t.rangemode?h<0?[y,0]:[0,b]:"nonnegative"===t.rangemode?[Math.max(0,y),Math.max(0,b)]:[y,b]}else p&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(o.val>=0&&(o={val:0,pad:0}),l.val<=0&&(l={val:0,pad:0})):"nonnegative"===t.rangemode&&(o.val-p*v(o)<0&&(o={val:0,pad:0}),l.val<0&&(l={val:1,pad:0})),p=(l.val-o.val)/(t._length-v(o)-v(l))),f=[o.val-p*v(o),l.val+p*v(l)]);return f[0]===f[1]&&("tozero"===t.rangemode?f=f[0]<0?[f[0],0]:f[0]>0?[0,f[0]]:[0,1]:(f=[f[0]-1,f[0]+1],"nonnegative"===t.rangemode&&(f[0]=Math.max(0,f[0])))),g&&f.reverse(),i.simpleMap(f,t.l2r||Number)}function s(t){var e=t._length/20;return"domain"===t.constrain&&t._inputDomain&&(e*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0])),function(t){return t.pad+(t.extrapad?e:0)}}function l(t){return n(t)&&Math.abs(t)=e}e.exports={getAutoRange:o,makePadFn:s,doAutoRange:function(t){t._length||t.setScale();var e,r=t._min&&t._max&&t._min.length&&t._max.length;t.autorange&&r&&(t.range=o(t),t._r=t.range.slice(),t._rl=i.simpleMap(t._r,t.r2l),(e=t._input).range=t.range.slice(),e.autorange=t.autorange);if(t._anchorAxis&&t._anchorAxis.rangeslider){var n=t._anchorAxis.rangeslider[t._name];n&&"auto"===n.rangemode&&(n.range=r?o(t):t._rangeInitial?t._rangeInitial.slice():t.range.slice()),(e=t._anchorAxis._input).rangeslider[t._name]=i.extendFlat({},n)}},expand:function(t,e,r){if(!function(t){return t.autorange||t._rangesliderAutorange}(t)||!e)return;t._min||(t._min=[]);t._max||(t._max=[]);r||(r={});t._m||t.setScale();var i,o,s,f,h,d,p,g,v,m,y,b,x=e.length,_=r.padded||!1,w=r.tozero&&("linear"===t.type||"-"===t.type),M="log"===t.type,A=!1;function T(t){if(Array.isArray(t))return A=!0,function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}var k=T((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),E=T((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=T(r.vpadplus||r.vpad),L=T(r.vpadminus||r.vpad);if(!A){if(y=1/0,b=-1/0,M)for(i=0;i0&&(y=f),f>b&&f-a&&(y=f),f>b&&f=x&&(f.extrapad||!_)){m=!1;break}A(i,f.val)&&f.pad<=x&&(_||!f.extrapad)&&(a.splice(o,1),o--)}if(m){var T=w&&0===i;a.push({val:i,pad:T?0:x,extrapad:!T&&_})}}}}var P=Math.min(6,x);for(i=0;i=P;i--)C(i)}}},{"../../constants/numerical":461,"../../lib":481,"fast-isnumeric":90}],525:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),u=t("../../components/titles"),c=t("../../components/color"),f=t("../../components/drawing"),h=t("../../constants/numerical"),d=h.ONEAVGYEAR,p=h.ONEAVGMONTH,g=h.ONEDAY,v=h.ONEHOUR,m=h.ONEMIN,y=h.ONESEC,b=h.MINUS_SIGN,x=h.BADNUM,_=t("../../constants/alignment").MID_SHIFT,w=t("../../constants/alignment").LINE_SPACING,M=e.exports={};M.setConvert=t("./set_convert");var A=t("./axis_autotype"),T=t("./axis_ids");M.id2name=T.id2name,M.name2id=T.name2id,M.cleanId=T.cleanId,M.list=T.list,M.listIds=T.listIds,M.getFromId=T.getFromId,M.getFromTrace=T.getFromTrace;var k=t("./autorange");M.expand=k.expand,M.getAutoRange=k.getAutoRange,M.coerceRef=function(t,e,r,n,i,a){var o=n.charAt(n.length-1),l=r._fullLayout._subplots[o+"axis"],u=n+"ref",c={};return i||(i=l[0]||a),a||(a=i),c[u]={valType:"enumerated",values:l.concat(a?[a]:[]),dflt:i},s.coerce(t,e,c,u)},M.coercePosition=function(t,e,r,n,i,a){var o,l;if("paper"===n||"pixel"===n)o=s.ensureNumber,l=r(i,a);else{var u=M.getFromId(e,n);l=r(i,a=u.fraction2r(a)),o=u.cleanPos}t[i]=o(l)},M.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:M.getFromId(e,r).cleanPos)(t)};var E=M.getDataConversions=function(t,e,r,n){var i,a="x"===r||"y"===r||"z"===r?r:n;if(Array.isArray(a)){if(i={type:A(n),_categories:[]},M.setConvert(i),"category"===i.type)for(var o=0;o2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},M.saveRangeInitial=function(t,e){for(var r=M.list(t,"",!0),n=!1,i=0;i.3*h||c(n)||c(a))){var d=r.dtick/2;t+=t+d.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=M.tickIncrement(t,"M6","reverse")+1.5*g:a.exactMonths>.8?t=M.tickIncrement(t,"M1","reverse")+15.5*g:t-=g/2;var l=M.tickIncrement(t,r);if(l<=n)return l}return t}(v,t,l.dtick,u,a)),p=v,0;p<=c;)p=M.tickIncrement(p,l.dtick,!1,a),0;return{start:e.c2r(v,0,a),end:e.c2r(p,0,a),size:l.dtick,_dataSpan:c-u}},M.prepTicks=function(t){var e=s.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=s.constrain(t._length/r,4,9)+1),"radialaxis"===t._name&&(n*=2)),"array"===t.tickmode&&(n*=100),M.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),F(t)},M.calcTicks=function(t){M.prepTicks(t);var e=s.simpleMap(t.range,t.r2l);if("array"===t.tickmode)return function(t){var e,r,n=t.tickvals,i=t.ticktext,a=new Array(n.length),o=s.simpleMap(t.range,t.r2l),l=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(l,u),f=Math.max(l,u),h=0;Array.isArray(i)||(i=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;"log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1));for(r=0;rc&&e=n:u<=n)&&!(a.length>l||u===o);u=M.tickIncrement(u,t.dtick,i,t.calendar))o=u,a.push(u);"angular"===t._id&&360===Math.abs(e[1]-e[0])&&a.pop(),t._tmax=a[a.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(a.length),f=0;f10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=g&&a<=10||e>=15*g)t._tickround="d";else if(e>=m&&a<=16||e>=v)t._tickround="M";else if(e>=y&&a<=19||e>=m)t._tickround="S";else{var o=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(i(e)||"L"===e.charAt(0)){var s=t.range.map(t.r2d||Number);i(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(s[0]),Math.abs(s[1])),u=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(u)>3&&(U(t.exponentformat)&&!V(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function j(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}M.autoTicks=function(t,e){var r;function n(t){return Math.pow(t,Math.floor(Math.log(e)/Math.LN10))}if("date"===t.type){t.tick0=s.dateTick0(t.calendar);var a=2*e;a>d?(e/=d,r=n(10),t.dtick="M"+12*D(e,r,C)):a>p?(e/=p,t.dtick="M"+D(e,1,P)):a>g?(t.dtick=D(e,g,R),t.tick0=s.dateTick0(t.calendar,!0)):a>v?t.dtick=D(e,v,P):a>m?t.dtick=D(e,m,O):a>y?t.dtick=D(e,y,O):(r=n(10),t.dtick=D(e,r,C))}else if("log"===t.type){t.tick0=0;var o=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var l=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/l,r=n(10),t.dtick="L"+D(e,r,C)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):"angular"===t._id?(t.tick0=0,r=1,t.dtick=D(e,r,z)):(t.tick0=0,r=n(10),t.dtick=D(e,r,C));if(0===t.dtick&&(t.dtick=1),!i(t.dtick)&&"string"!=typeof t.dtick){var u=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(u)}},M.tickIncrement=function(t,e,r,a){var o=r?-1:1;if(i(e))return t+o*e;var l=e.charAt(0),u=o*Number(e.substr(1));if("M"===l)return s.incrementMonth(t,u,a);if("L"===l)return Math.log(Math.pow(10,t)+u)/Math.LN10;if("D"===l){var c="D2"===e?N:I,f=t+.01*o,h=s.roundUp(s.mod(f,1),c,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(e)},M.tickFirst=function(t){var e=t.r2l||Number,r=s.simpleMap(t.range,e),a=r[1]"+l,t._prevDateHead=l));e.text=u}(t,o,r,u):"log"===t.type?function(t,e,r,n,a){var o=t.dtick,l=e.x,u=t.tickformat;"never"===a&&(a="");!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3");if(u||"string"==typeof o&&"L"===o.charAt(0))e.text=H(Math.pow(10,l),t,a,n);else if(i(o)||"D"===o.charAt(0)&&s.mod(l+.01,1)<.1){var c=Math.round(l);-1!==["e","E","power"].indexOf(t.exponentformat)||U(t.exponentformat)&&V(c)?(e.text=0===c?1:1===c?"10":c>1?"10"+c+"":"10"+b+-c+"",e.fontSize*=1.25):(e.text=H(Math.pow(10,l),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,s.mod(l,1)))),e.fontSize*=.75}if("D1"===t.dtick){var f=String(e.text).charAt(0);"0"!==f&&"1"!==f||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(l<0?.5:.25)))}}(t,o,0,u,n):"category"===t.type?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"angular"===t._id?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=H(e.x,t,i,n);else{var a=e.x/180;if(0===a)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){var r=1;for(;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,i=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/i),Math.round(r/i)]}(a);if(o[1]>=100)e.text=H(s.deg2rad(e.x),t,i,n);else{var l=e.x<0;1===o[1]?1===o[0]?e.text="\u03c0":e.text=o[0]+"\u03c0":e.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),l&&(e.text=b+e.text)}}}}(t,o,r,u,n):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide");e.text=H(e.x,t,i,n)}(t,o,0,u,n),t.tickprefix&&!d(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!d(t.showticksuffix)&&(o.text+=t.ticksuffix),o},M.hoverLabelText=function(t,e,r){if(r!==x&&r!==e)return M.hoverLabelText(t,e)+" - "+M.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=M.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":b+i:i};var B=["f","p","n","\u03bc","m","","k","M","G","T"];function U(t){return"SI"===t||"B"===t}function V(t){return t>14||t<-15}function H(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=M.getTickFormat(e),f=e.separatethousands;if(n){var h={exponentformat:l,dtick:"none"===e.showexponent?e.dtick:i(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};F(h),o=(Number(h._tickround)||0)+4,u=h._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,b);var d,p=Math.pow(10,-o)/2;if("none"===l&&(u=0),(t=Math.abs(t))"+d+"":"B"===l&&9===u?t+="B":U(l)&&(t+=B[u/3+5]));return a?b+t:t}function q(t,e){for(var r=0;r=0,a=u(t,e[1])<=0;return(r||i)&&(n||a)}if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(e=0;e=a(n))){r=t.tickformatstops[e];break}break;case"log":for(e=0;e1&&e1)for(n=1;n2*o}(t,e)?"date":function(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,o=0,s=0;s2*n}(t)?"category":function(t){if(!t)return!1;for(var e=0;en?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)}},{"../../registry":577,"./constants":530}],529:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){if("category"===e.type){var i,a=t.categoryarray,o=Array.isArray(a)&&a.length>0;o&&(i="array");var s,l=r("categoryorder",i);"array"===l&&(s=r("categoryarray")),o||"array"!==l||(l=e.categoryorder="trace"),"trace"===l?e._initialCategories=[]:"array"===l?e._initialCategories=s.slice():(s=function(t,e){var r,n,i,a=e.dataAttr||t._id.charAt(0),o={};if(e.axData)r=e.axData;else for(r=[],n=0;no*y)||w)for(r=0;rO&&NC&&(C=N);h/=(C-L)/(2*P),L=u.l2r(L),C=u.l2r(C),u.range=u._input.range=k=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function O(t,e,r,n,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",i+"Z")}function R(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function I(t,e,r,n,i,a){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),N(t,e,i,a)}function N(t,e,r,n){r||(t.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function z(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function D(t){T&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),T=!1)}function F(t){return"lasso"===t||"select"===t}function j(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,A)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function B(t,e){if(a){var r=void 0!==t.onwheel?"wheel":"mousewheel";t._onwheel&&t.removeEventListener(r,t._onwheel),t._onwheel=e,t.addEventListener(r,e,{passive:!1})}else void 0!==t.onwheel?t.onwheel=e:void 0!==t.onmousewheel&&(t.onmousewheel=e)}function U(t){var e=[];for(var r in t)e.push(t[r]);return e}e.exports={makeDragBox:function(t,e,r,a,c,d,T,k){var N,V,H,q,G,X,W,Y,Z,Q,J,K,$,tt,et,rt,nt,it,at,ot,st,lt=t._fullLayout._zoomlayer,ut=T+k==="nsew",ct=1===(T+k).length;function ft(){if(N=e.xaxis,V=e.yaxis,Z=N._length,Q=V._length,W=N._offset,Y=V._offset,(H={})[N._id]=N,(q={})[V._id]=V,T&&k)for(var r=e.overlays,n=0;nA||o>A?(xt="xy",a/Z>o/Q?(o=a*Q/Z,gt>i?vt.t=gt-o:vt.b=gt+o):(a=o*Z/Q,pt>n?vt.l=pt-a:vt.r=pt+a),wt.attr("d",j(vt))):s():!$||o10||r.scrollWidth-r.clientWidth>10)){clearTimeout(Rt);var n=-e.deltaY;if(isFinite(n)||(n=e.wheelDelta/10),isFinite(n)){var i,a=Math.exp(-Math.min(Math.max(n,-20),20)/200),o=Nt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-o.left)/o.width,u=(o.bottom-e.clientY)/o.height;if(rt){for(k||(l=.5),i=0;ig[1]-.01&&(e.domain=s),i.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":481,"fast-isnumeric":90}],541:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var i=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=i[0]+(i[1]-i[0])*r;t.range=t._input.range=[t.l2r(a+(i[0]-a)*e),t.l2r(a+(i[1]-a)*e)]}},{"../../constants/alignment":457}],542:[function(t,e,r){"use strict";var n=t("polybooljs"),i=t("../../registry"),a=t("../../components/color"),o=t("../../components/fx"),s=t("../../lib/polygon"),l=t("../../lib/throttle"),u=t("../../components/fx/helpers").makeEventData,c=t("./axis_ids").getFromId,f=t("../sort_modules").sortModules,h=t("./constants"),d=h.MINSELECT,p=s.filter,g=s.tester,v=s.multitester;function m(t){return t._id}function y(t,e,r){var n,a,o,s;if(r){var l=r.points||[];for(n=0;n0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*c*Math.abs(n-i))}return h}function m(e,r,n){var a=l(e,n||t.calendar);if(a===h){if(!i(e))return h;a=l(new Date(+e))}return a}function y(e,r,n){return s(e,r,n||t.calendar)}function b(e){return t._categories[Math.round(e)]}function x(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(i(e))return+e}function _(e){return i(e)?n.round(t._b+t._m*e,2):h}function w(e){return(e-t._b)/t._m}t.c2l="log"===t.type?v:u,t.l2c="log"===t.type?g:u,t.l2p=_,t.p2l=w,t.c2p="log"===t.type?function(t,e){return _(v(t,e))}:_,t.p2c="log"===t.type?function(t){return g(w(t))}:w,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=o,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(o(e))},t.p2d=t.p2r=w,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return v(o(t),e)},t.r2d=t.r2c=function(t){return g(o(t))},t.d2c=t.r2l=o,t.c2d=t.l2r=u,t.c2r=v,t.l2d=g,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return g(w(t))},t.r2p=function(e){return t.l2p(o(e))},t.p2r=w,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=a.identity,t.d2c=t.r2c=t.d2l=t.r2l=m,t.c2d=t.c2r=t.l2d=t.l2r=y,t.d2p=t.r2p=function(e,r,n){return t.l2p(m(e,0,n))},t.p2d=t.p2r=function(t,e,r){return y(w(t),e,r)},t.cleanPos=function(e){return a.cleanDate(e,h,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=function(e){if(null!=e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h},t.r2d=t.c2d=t.l2d=b,t.d2r=t.d2l_noadd=x,t.r2c=function(e){var r=x(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=x,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return b(w(t))},t.r2p=t.d2p,t.p2r=w,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e,n){n||(n={}),e||(e="range");var o,s,l=a.nestedProperty(t,e).get();if(s=(s="date"===t.type?a.dfltRange(t.calendar):"y"===r?d.DFLTRANGEY:n.dfltRange||d.DFLTRANGEX).slice(),l&&2===l.length)for("date"===t.type&&(l[0]=a.cleanDate(l[0],h,t.calendar),l[1]=a.cleanDate(l[1],h,t.calendar)),o=0;o<2;o++)if("date"===t.type){if(!a.isDateTime(l[o],t.calendar)){t[e]=s;break}if(t.r2l(l[0])===t.r2l(l[1])){var u=a.constrain(t.r2l(l[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);l[0]=t.l2r(u-1e3),l[1]=t.l2r(u+1e3);break}}else{if(!i(l[o])){if(!i(l[1-o])){t[e]=s;break}l[o]=l[1-o]*(o?10:.1)}if(l[o]<-f?l[o]=-f:l[o]>f&&(l[o]=f),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else a.nestedProperty(t,e).set(s)},t.setScale=function(n){var i=e._size;if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=p.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var o=n&&t._r?"_r":"range",s=t.calendar;t.cleanRange(o);var l=t.r2l(t[o][0],s),u=t.r2l(t[o][1],s);if("y"===r?(t._offset=i.t+(1-t.domain[1])*i.h,t._length=i.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-u),t._b=-t._m*u):(t._offset=i.l+t.domain[0]*i.w,t._length=i.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw e._replotting=!1,new Error("Something went wrong with axis scaling")},t.makeCalcdata=function(e,r){var n,i,o,s,l=t.type,u="date"===l&&e[r+"calendar"];if(r in e){if(n=e[r],s=e._length||n.length,a.isTypedArray(n)&&("linear"===l||"log"===l)){if(s===n.length)return n;if(n.subarray)return n.subarray(0,s)}for(i=new Array(s),o=0;o0?Number(c):u;else if("string"!=typeof c)e.dtick=u;else{var f=c.charAt(0),h=c.substr(1);((h=n(h)?Number(h):0)<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=u)}var d="date"===o?i.dateTick0(e.calendar):0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==c&&"D2"!==c?e.tick0=Number(p):e.tick0=d}else{void 0===r("tickvals")?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":461,"../../lib":481,"fast-isnumeric":90}],547:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../registry"),a=t("../../components/drawing"),o=t("./axes"),s=t("./constants").attrRegex;e.exports=function(t,e,r,l){var u=t._fullLayout,c=[];var f,h,d,p,g=function(t){var e,r,n,i,a={};for(e in t)if((r=e.split("."))[0].match(s)){var o=e.charAt(0),l=r[0];if(n=u[l],i={},Array.isArray(t[e])?i.to=t[e].slice(0):Array.isArray(t[e].range)&&(i.to=t[e].range.slice(0)),!i.to)continue;i.axisName=l,i.length=n._length,c.push(o),a[o]=i}return a}(e),v=Object.keys(g),m=function(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(-1===s.indexOf(l)){var u=l.xaxis._id,c=l.yaxis._id,f=l.xaxis.range,h=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice(),l.yaxis._r=l.yaxis.range.slice(),i=r[u]?r[u].to:f,a=r[c]?r[c].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||-1===e.indexOf(u)&&-1===e.indexOf(c)||s.push(l)}}return s}(u,v,g);if(!m.length)return function(){function e(e,r,n){for(var i=0;i rect").call(a.setTranslate,0,0).call(a.setScale,1,1),t.plot.call(a.setTranslate,e._offset,r._offset).call(a.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(a.setPointGroupScale,1,1),n.selectAll(".textpoint").call(a.setTextPointsScale,1,1),n.call(a.hideOutsideRangePoints,t)}function b(e,r){var n,s,l,c=g[e.xaxis._id],f=g[e.yaxis._id],h=[];if(c){s=(n=t._fullLayout[c.axisName])._r,l=c.to,h[0]=(s[0]*(1-r)+r*l[0]-s[0])/(s[1]-s[0])*e.xaxis._length;var d=s[1]-s[0],p=l[1]-l[0];n.range[0]=s[0]*(1-r)+r*l[0],n.range[1]=s[1]*(1-r)+r*l[1],h[2]=e.xaxis._length*(1-r+r*p/d)}else h[0]=0,h[2]=e.xaxis._length;if(f){s=(n=t._fullLayout[f.axisName])._r,l=f.to,h[1]=(s[1]*(1-r)+r*l[1]-s[1])/(s[0]-s[1])*e.yaxis._length;var v=s[1]-s[0],m=l[1]-l[0];n.range[0]=s[0]*(1-r)+r*l[0],n.range[1]=s[1]*(1-r)+r*l[1],h[3]=e.yaxis._length*(1-r+r*m/v)}else h[1]=0,h[3]=e.yaxis._length;!function(e,r){var n,a=[];for(a=[e._id,r._id],n=0;nr.duration?(function(){for(var e={},r=0;r0&&i["_"+r+"axes"][e])return i;if((i[r+"axis"]||r)===e){if(s(i,r))return i;if((i[r]||[]).length||i[r+"0"])return i}}}(e,r,a);if(!l)return;if("histogram"===l.type&&a==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");var u,c=a+"calendar",f=l[c];if(s(l,a)){var h=o(l),d=[];for(u=0;u0?".":"")+a;i.isPlainObject(o)?l(o,e,s,n+1):e(s,a,o)}})}r.manageCommandObserver=function(t,e,n,o){var s={},l=!0;e&&e._commandObserver&&(s=e._commandObserver),s.cache||(s.cache={}),s.lookupTable={};var u=r.hasSimpleAPICommandBindings(t,n,s.lookupTable);if(e&&e._commandObserver){if(u)return s;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,s}if(u){a(t,u,s.cache),s.check=function(){if(l){var e=a(t,u,s.cache);return e.changed&&o&&void 0!==s.lookupTable[e.value]&&(s.disable(),Promise.resolve(o({value:e.value,type:u.type,prop:u.prop,traces:u.traces,index:s.lookupTable[e.value]})).then(s.enable,s.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fMath.abs(e))u.rotate(a,0,0,-t*r*Math.PI*p.rotateSpeed/window.innerWidth);else{var o=-p.zoomSpeed*i*e/window.innerHeight*(a-u.lastT())/20;u.pan(a,0,0,f*(Math.exp(o)-1))}}},!0),p};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset"),l=t("has-passive-events")},{"3d-view":10,"has-passive-events":232,"mouse-change":250,"mouse-event-offset":251,"mouse-wheel":253,"right-now":295}],555:[function(t,e,r){"use strict";var n=t("../../plot_api/edit_types").overrideAll,i=t("../../components/fx/layout_attributes"),a=t("./scene"),o=t("../get_data").getSubplotData,s=t("../../lib"),l=t("../../constants/xmlns_namespaces");r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=r.attrRegex=s.counterRegex("scene"),r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.baseLayoutAttrOverrides=n({hoverlabel:i.hoverlabel},"plot","nested"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,n=e._subplots.gl3d,i=0;i1;o(t,e,r,{type:"gl3d",attributes:l,handleDefaults:u,fullLayout:e,font:e.font,fullData:r,getDfltFromLayout:function(e){if(!i)return n.validate(t[e],l[e])?t[e]:void 0},paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":357,"../../../lib":481,"../../../registry":577,"../../subplot_defaults":576,"./axis_defaults":558,"./layout_attributes":561}],561:[function(t,e,r){"use strict";var n=t("./axis_attributes"),i=t("../../domain").attributes,a=t("../../../lib/extend").extendFlat,o=t("../../../lib").counterRegex;function s(t,e,r){return{x:{valType:"number",dflt:t,editType:"camera"},y:{valType:"number",dflt:e,editType:"camera"},z:{valType:"number",dflt:r,editType:"camera"},editType:"camera"}}e.exports={_arrayAttrRegexps:[o("scene",".annotations",!0)],bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"plot"},camera:{up:a(s(0,0,1),{}),center:a(s(0,0,0),{}),eye:a(s(1.25,1.25,1.25),{}),editType:"camera"},domain:i({name:"scene",editType:"plot"}),aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto",editType:"plot",impliedEdits:{"aspectratio.x":void 0,"aspectratio.y":void 0,"aspectratio.z":void 0}},aspectratio:{x:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},y:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},z:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},editType:"plot",impliedEdits:{aspectmode:"manual"}},xaxis:n,yaxis:n,zaxis:n,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],dflt:"turntable",editType:"plot"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest",editType:"modebar"},editType:"plot",_deprecated:{cameraposition:{valType:"info_array",editType:"camera"}}}},{"../../../lib":481,"../../../lib/extend":473,"../../domain":550,"./axis_attributes":557}],562:[function(t,e,r){"use strict";var n=t("../../../lib/str2rgbarray"),i=["xaxis","yaxis","zaxis"];function a(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}a.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[i[e]];r.visible?(this.enabled[e]=r.showspikes,this.colors[e]=n(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness):(this.enabled[e]=!1,this.drawSides[e]=!1)}},e.exports=function(t){var e=new a;return e.merge(t),e}},{"../../../lib/str2rgbarray":503}],563:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.axesOptions,r=t.glplot.axesPixels,l=t.fullSceneLayout,u=[[],[],[]],c=0;c<3;++c){var f=l[o[c]];if(f._length=(r[c].hi-r[c].lo)*r[c].pixelsPerDataUnit/t.dataScale[c],Math.abs(f._length)===1/0)u[c]=[];else{f._input_range=f.range.slice(),f.range[0]=r[c].lo/t.dataScale[c],f.range[1]=r[c].hi/t.dataScale[c],f._m=1/(t.dataScale[c]*r[c].pixelsPerDataUnit),f.range[0]===f.range[1]&&(f.range[0]-=1,f.range[1]+=1);var h=f.tickmode;if("auto"===f.tickmode){f.tickmode="linear";var d=f.nticks||i.constrain(f._length/40,4,9);n.autoTicks(f,Math.abs(f.range[1]-f.range[0])/d)}for(var p=n.calcTicks(f),g=0;g")}else v=u.textLabel;t.fullSceneLayout.hovermode&&f.loneHover({x:(.5+.5*p[0]/p[3])*i,y:(.5-.5*p[1]/p[3])*a,xLabel:w,yLabel:M,zLabel:A,text:v,name:l.name,color:f.castHoverOption(e,m,"bgcolor")||l.color,borderColor:f.castHoverOption(e,m,"bordercolor"),fontFamily:f.castHoverOption(e,m,"font.family"),fontSize:f.castHoverOption(e,m,"font.size"),fontColor:f.castHoverOption(e,m,"font.color")},{container:r,gd:t.graphDiv});var k={x:u.traceCoordinate[0],y:u.traceCoordinate[1],z:u.traceCoordinate[2],data:e._input,fullData:e,curveNumber:e.index,pointNumber:m};f.appendArrayPointValue(k,e,m);var E={points:[k]};u.buttons&&u.distance<5?t.graphDiv.emit("plotly_click",E):t.graphDiv.emit("plotly_hover",E),o=E}else f.loneUnhover(r),t.graphDiv.emit("plotly_unhover",o);t.drawAnnotations(t)}.bind(null,t),t.traces={},!0}function x(t,e){var r=document.createElement("div"),n=t.container;this.graphDiv=t.graphDiv;var i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.style.position="absolute",i.style.top=i.style.left="0px",i.style.width=i.style.height="100%",i.style["z-index"]=20,i.style["pointer-events"]="none",r.appendChild(i),this.svgContainer=i,r.id=t.id,r.style.position="absolute",r.style.top=r.style.left="0px",r.style.width=r.style.height="100%",n.appendChild(r),this.fullLayout=e,this.id=t.id||"scene",this.fullSceneLayout=e[this.id],this.plotArgs=[[],{},{}],this.axesOptions=v(e[this.id]),this.spikeOptions=m(e[this.id]),this.container=r,this.staticMode=!!t.staticPlot,this.pixelRatio=t.plotGlPixelRatio||2,this.dataScale=[1,1,1],this.contourLevels=[[],[],[]],this.convertAnnotations=l.getComponentMethod("annotations3d","convert"),this.drawAnnotations=l.getComponentMethod("annotations3d","draw"),b(this)}var _=x.prototype;_.recoverContext=function(){var t=this,e=this.glplot.gl,r=this.glplot.canvas;this.glplot.dispose(),requestAnimationFrame(function n(){e.isContextLost()?requestAnimationFrame(n):b(t,t.fullLayout,r,e)?t.plot.apply(t,t.plotArgs):u.error("Catastrophic and unrecoverable WebGL error. Context lost.")})};var w=["xaxis","yaxis","zaxis"];function M(t,e,r){for(var n=t.fullSceneLayout,i=0;i<3;i++){var a=w[i],o=a.charAt(0),s=n[a],l=e[o],c=e[o+"calendar"],f=e["_"+o+"length"];if(u.isArrayOrTypedArray(l))for(var h,d=0;d<(f||l.length);d++)if(u.isArrayOrTypedArray(l[d]))for(var p=0;pf[1][o]?d[o]=1:f[1][o]===f[0][o]?d[o]=1:d[o]=1/(f[1][o]-f[0][o]);for(this.dataScale=d,this.convertAnnotations(this),a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var S=g[1][a]-g[0][a];g[0][a]-=S/32,g[1][a]+=S/32}}else{var L=s.range;g[0][a]=s.r2l(L[0]),g[1][a]=s.r2l(L[1])}g[0][a]===g[1][a]&&(g[0][a]-=1,g[1][a]+=1),v[a]=g[1][a]-g[0][a],this.glplot.bounds[0][a]=g[0][a]*d[a],this.glplot.bounds[1][a]=g[1][a]*d[a]}var C=[1,1,1];for(a=0;a<3;++a){var P=m[l=(s=u[w[a]]).type];C[a]=Math.pow(P.acc,1/P.count)/d[a]}var O;if("auto"===u.aspectmode)O=Math.max.apply(null,C)/Math.min.apply(null,C)<=4?C:[1,1,1];else if("cube"===u.aspectmode)O=[1,1,1];else if("data"===u.aspectmode)O=C;else{if("manual"!==u.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var R=u.aspectratio;O=[R.x,R.y,R.z]}u.aspectratio.x=c.aspectratio.x=O[0],u.aspectratio.y=c.aspectratio.y=O[1],u.aspectratio.z=c.aspectratio.z=O[2],this.glplot.aspect=O;var I=u.domain||null,N=e._size||null;if(I&&N){var z=this.container.style;z.position="absolute",z.left=N.l+I.x[0]*N.w+"px",z.top=N.t+(1-I.y[1])*N.h+"px",z.width=N.w*(I.x[1]-I.x[0])+"px",z.height=N.h*(I.y[1]-I.y[0])+"px"}this.glplot.redraw()}},_.destroy=function(){this.glplot&&(this.camera.mouseListener.enabled=!1,this.container.removeEventListener("wheel",this.camera.wheelListener),this.camera=this.glplot.camera=null,this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null)},_.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),A(this.glplot.camera)},_.setCamera=function(t){var e;this.glplot.camera.lookAt.apply(this,[[(e=t).eye.x,e.eye.y,e.eye.z],[e.center.x,e.center.y,e.center.z],[e.up.x,e.up.y,e.up.z]])},_.saveCamera=function(t){var e=this.getCamera(),r=u.nestedProperty(t,this.id+".camera"),n=r.get(),i=!1;function a(t,e,r,n){var i=["up","center","eye"],a=["x","y","z"];return e[i[r]]&&t[i[r]][a[n]]===e[i[r]][a[n]]}if(void 0===n)i=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!a(e,n,o,s)){i=!0;break}return i&&r.set(e),i},_.updateFx=function(t,e){var r=this.camera;r&&("orbit"===t?(r.mode="orbit",r.keyBindingMode="rotate"):"turntable"===t?(r.up=[0,0,1],r.mode="turntable",r.keyBindingMode="rotate"):r.keyBindingMode=t),this.fullSceneLayout.hovermode=e},_.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(n),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,i=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var a=new Uint8Array(r*i*4);e.readPixels(0,0,r,i,e.RGBA,e.UNSIGNED_BYTE,a);for(var o=0,s=i-1;o=e.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=e._paper.attr("width")-7),r.attr(a);var o=r.select(".js-link-to-tool"),u=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&function(t,e){e.text("");var r=e.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(t._context.linkText+" "+String.fromCharCode(187));if(t._context.sendData)r.on("click",function(){v.sendDataToCloud(t)});else{var n=window.location.pathname.split("/"),i=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+i})}}(t,o),u.text(o.text()&&c.text()?" - ":"")}},v.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=n.select(t).append("div").attr("id","hiddenform").style("display","none"),i=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return i.append("input").attr({type:"text",name:"data"}).node().value=v.graphJson(t,!1,"keepdata"),i.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1};var b,x=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],_=["year","month","dayMonth","dayMonthYear"];function w(t,e){var r=t._context.locale,n=!1,i={};function o(t){for(var r=!0,a=0;a1&&I.length>1){for(a.getComponentMethod("grid","sizeDefaults")(u,l),o=0;o15&&I.length>15&&0===l.shapes.length&&0===l.images.length,l._hasCartesian=l._has("cartesian"),l._hasGeo=l._has("geo"),l._hasGL3D=l._has("gl3d"),l._hasGL2D=l._has("gl2d"),l._hasTernary=l._has("ternary"),l._hasPie=l._has("pie"),v.linkSubplots(d,l,h,i),v.cleanPlot(d,l,h,i,y),p(l,i),v.doAutoMargin(t);var F=c.list(t);for(o=0;o0){var c=function(t){var e,r={left:0,right:0,bottom:0,top:0};if(t)for(e in t)t.hasOwnProperty(e)&&(r.left+=t[e].left||0,r.right+=t[e].right||0,r.bottom+=t[e].bottom||0,r.top+=t[e].top||0);return r}(t._boundingBoxMargins),f=c.left+c.right,h=c.bottom+c.top,d=1-2*l,p=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(d*(p.width-f)),a=Math.round(d*(p.height-h))}else{var g=u?window.getComputedStyle(t):{};n=parseFloat(g.width)||r.width,a=parseFloat(g.height)||r.height}var m=v.layoutAttributes.width.min,y=v.layoutAttributes.height.min;n1,x=!e.height&&Math.abs(r.height-a)>1;(x||b)&&(b&&(r.width=n),x&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),v.sanitizeMargins(r)},v.supplyLayoutModuleDefaults=function(t,e,r,n){var i,o,l,u=a.componentsRegistry,c=e._basePlotModules,f=a.subplotsRegistry.cartesian;for(i in u)(l=u[i]).includeBasePlot&&l.includeBasePlot(t,e);for(var h in c.length||c.push(f),e._has("cartesian")&&(a.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[h].sort(s.subplotSort);for(o=0;o.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];n._replotting||v.doAutoMargin(t)}},v.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),o=Math.max(e.margin.l||0,0),s=Math.max(e.margin.r||0,0),l=Math.max(e.margin.t||0,0),u=Math.max(e.margin.b||0,0),c=e._pushmargin;if(!1!==e.margin.autoexpand)for(var f in c.base={l:{val:0,size:o},r:{val:1,size:s},t:{val:1,size:l},b:{val:0,size:u}},c){var h=c[f].l||{},d=c[f].b||{},p=h.val,g=h.size,v=d.val,m=d.size;for(var y in c){if(i(g)&&c[y].r){var b=c[y].r.val,x=c[y].r.size;if(b>p){var _=(g*b+(x-e.width)*p)/(b-p),w=(x*(1-p)+(g-e.width)*(1-b))/(b-p);_>=0&&w>=0&&_+w>o+s&&(o=_,s=w)}}if(i(m)&&c[y].t){var M=c[y].t.val,A=c[y].t.size;if(M>v){var T=(m*M+(A-e.height)*v)/(M-v),k=(A*(1-v)+(m-e.height)*(1-M))/(M-v);T>=0&&k>=0&&T+k>u+l&&(u=T,l=k)}}}}if(r.l=Math.round(o),r.r=Math.round(s),r.t=Math.round(l),r.b=Math.round(u),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return a.call("plot",t)},v.graphJson=function(t,e,r,n,i){(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&v.supplyDefaults(t);var a=i?t._fullData:t.data,o=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function u(t){if("function"==typeof t)return null;if(s.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!s.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;i[e]=u(t[e])}return i}return Array.isArray(t)?t.map(u):s.isJSDate(t)?s.ms2DateTimeLocal(+t):t}var c={data:(a||[]).map(function(t){var r=u(t);return e&&delete r.fit,r})};return e||(c.layout=u(o)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),l&&(c.frames=u(l)),"object"===n?c:JSON.stringify(c)},v.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){d=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return a.call("redraw",t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var n,l,u=0,c=0;function f(){return u++,function(){var r;c++,d||c!==u||(r=e,t._transitionData&&(function(t){if(t)for(;t.length;)t.shift()}(t._transitionData._interruptCallbacks),Promise.resolve().then(function(){if(i.redraw)return a.call("redraw",t)}).then(function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])}).then(r)))}}var p=t._fullLayout._basePlotModules,g=!1;if(r)for(l=0;l=0;s--)if(o[s].enabled){r._indexToPoints=o[s]._indexToPoints;break}n&&n.calc&&(a=n.calc(t,r))}Array.isArray(a)&&a[0]||(a=[{x:u,y:u}]),a[0].t||(a[0].t={}),a[0].trace=r,d[e]=a}}for(v&&A(l),i=0;i=0?h.angularAxis.domain:n.extent(M),S=Math.abs(M[1]-M[0]);T&&!A&&(S=0);var L=E.slice();k&&A&&(L[1]+=S);var C=h.angularAxis.ticksCount||4;C>8&&(C=C/(C/8)+C%8),h.angularAxis.ticksStep&&(C=(L[1]-L[0])/C);var P=h.angularAxis.ticksStep||(L[1]-L[0])/(C*(h.minorTicks+1));w&&(P=Math.max(Math.round(P),1)),L[2]||(L[2]=P);var O=n.range.apply(this,L);if(O=O.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(L.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=k?S:0,void 0===(t=n.select(this).select("svg.chart-root"))||t.empty()){var R=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),I=this.appendChild(this.ownerDocument.importNode(R.documentElement,!0));t=n.select(I)}t.select(".guides-group").style({"pointer-events":"none"}),t.select(".angular.axis-group").style({"pointer-events":"none"}),t.select(".radial.axis-group").style({"pointer-events":"none"});var N,z=t.select(".chart-group"),D={fill:"none",stroke:h.tickColor},F={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){N=t.select(".legend-group").attr({transform:"translate("+[b,h.margin.top]+")"}).style({display:"block"});var j=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend=void 0===t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:N,elements:j,reverseOrder:h.legend.reverseOrder})})();var B=N.node().getBBox();b=Math.min(h.width-B.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,b=Math.max(10,b),_=[h.margin.left+b,h.margin.top+b],r.range([0,b]),c.layout.radialAxis.domain=r.domain(),N.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else N=t.select(".legend-group").style({display:"none"});t.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),z.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(h.width-(h.margin.left+h.margin.right+2*b+(B?B.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*b))/2];if(U[0]=Math.max(0,U[0]),U[1]=Math.max(0,U[1]),t.select(".outer-group").attr("transform","translate("+U+")"),h.title){var V=t.select("g.title-group text").style(F).text(h.title),H=V.node().getBBox();V.attr({x:_[0]-H.width/2,y:_[1]-b-20})}var q=t.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var G=q.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(D),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:b}).style(D);var X=t.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});function W(t,e){return s(t)%360+h.orientation}if(h.radialAxis.visible){var Y=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(Y).attr({transform:"rotate("+h.radialAxis.orientation+")"}),q.selectAll(".domain").style(D),q.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(F).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,F["font-size"]]+")":"translate("+[0,F["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var Z=t.select(".angular.axis-group").selectAll("g.angular-tick").data(O),Q=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+W(t)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),Z.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(D),Q.selectAll(".minor").style({stroke:h.minorTickColor}),Z.select("line.grid-line").attr({x1:h.tickLength?b-h.tickLength:0,x2:b}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(F);var J=Z.select("text.axis-text").attr({x:b+h.labelOffset,dy:a+"em",transform:function(t,e){var r=W(t),n=b+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:h.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(h.minorTicks+1)!=0?"":w?w[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(F);h.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var K=n.max(z.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));N.attr({transform:"translate("+[b+K,h.margin.top]+")"});var $=t.select("g.geometry-group").selectAll("g").size()>0,tt=t.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||$){var et=[];d.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=s,n.container=tt.filter(function(t,r){return r==e}),n.geometry=t.geometry,n.orientation=h.orientation,n.direction=h.direction,n.index=e,et.push({data:t,geometryConfig:n})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return i(o[r].defaultConfig(),t)});o[r]().config(n)()})}var it,at,ot=t.select(".guides-group"),st=t.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!A){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});z.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(X).angle;ft.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;it=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(it)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});z.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(X).radius;ht.attr({r:n}).style({opacity:.5}),at=r.invert(o.util.getMousePos(X).radius);var i=o.util.convertToCartesian(n,h.radialAxis.orientation);ut.text(o.util.round(at)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ht.style({opacity:0}),ct.hide(),lt.hide(),ut.hide()}),t.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(e,r){var i=n.select(this),a=this.style.fill,s="black",l=this.style.opacity||1;if(i.attr({"data-opacity":l}),a&&"none"!==a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(e[0]),r:o.util.round(e[1])};A&&(u.t=w[e[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=t.node().getBoundingClientRect(),d=[f.left+f.width/2-U[0]-h.left,f.top+f.height/2-U[1]-h.top];ct.config({color:s}).text(c),ct.move(d)}else a=this.style.stroke||"black",i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.hide();var r=n.select(this),i=r.attr("data-fill");i?r.style({fill:i,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})})}(u),this},h.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),i(l.data[e],o.Axis.defaultConfig().data[0]),i(l.data[e],t)}),i(l.layout,o.Axis.defaultConfig().layout),i(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return r},h.angularScale=function(t){return s},h.svg=function(){return t},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var i=e||6,a=[],o=[];n.range(0,360+i,i).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],i=e[1],a={};return a.x=r,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+i*i),a},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i0)){var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:c(s),transform:function(t,r){return"rotate("+(e.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return p.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return p.stroke(r,i,a)},"stroke-width":function(t,e){return p["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return p["stroke-dasharray"](r,i,a)},opacity:function(t,e){return p.opacity(r,i,a)},display:function(t,e){return p.display(r,i,a)}})}};var f=e.angularScale.range(),h=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,d=n.svg.arc().startAngle(function(t){return-h/2}).endAngle(function(t){return h/2}).innerRadius(function(t){return e.radialScale(l+(t[2]||0))}).outerRadius(function(t){return e.radialScale(l+(t[2]||0))+e.radialScale(t[1])});u.arc=function(t,r,i){n.select(this).attr({class:"mark arc",d:d,transform:function(t,r){return"rotate("+(e.orientation+s(t[0])+90)+")"}})};var p={fill:function(e,r,n){return t[n].data.color},stroke:function(e,r,n){return t[n].data.strokeColor},"stroke-width":function(e,r,n){return t[n].data.strokeSize+"px"},"stroke-dasharray":function(e,n,i){return r[t[i].data.strokeDash]},opacity:function(e,r,n){return t[n].data.opacity},display:function(e,r,n){return void 0===t[n].data.visible||t[n].data.visible?"block":"none"}},g=n.select(this).selectAll("g.layer").data(o);g.enter().append("g").attr({class:"layer"});var v=g.selectAll("path.mark").data(function(t,e){return t});v.enter().append("path").attr({class:"mark"}),v.style(p).each(u[e.geometryType]),v.exit().remove(),g.exit().remove()})}return a.config=function(e){return arguments.length?(e.forEach(function(e,r){t[r]||(t[r]={}),i(t[r],o.PolyChart.defaultConfig()),i(t[r],e)}),this):t},a.getColorScale=function(){},n.rebind(a,e,"on"),a},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){var t=o.Legend.defaultConfig(),e=n.dispatch("hover");function r(){var e=t.legendConfig,a=t.data.map(function(t,r){return[].concat(t).map(function(t,n){var a=i({},e.elements[r]);return a.name=t,a.color=[].concat(e.elements[r].color)[n],a})}),o=n.merge(a);o=o.filter(function(t,r){return e.elements[r]&&(e.elements[r].visibleInLegend||void 0===e.elements[r].visibleInLegend)}),e.reverseOrder&&(o=o.reverse());var s=e.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=e.fontSize,c=null==e.isContinuous?"number"==typeof o[0]:e.isContinuous,f=c?e.height:u*o.length,h=s.classed("legend-group",!0).selectAll("svg").data([0]),d=h.enter().append("svg").attr({width:300,height:f+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});d.append("g").classed("legend-axis",!0),d.append("g").classed("legend-marks",!0);var p=n.range(o.length),g=n.scale[c?"linear":"ordinal"]().domain(p).range(l),v=n.scale[c?"linear":"ordinal"]().domain(p)[c?"range":"rangePoints"]([0,f]);if(c){var m=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);m.enter().append("stop"),m.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:e.height,width:e.colorBandWidth,fill:"url(#grad1)"})}else{var y=h.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var r,i,a,o=t.symbol;return a=3*(i=u),"line"===(r=o)?"M"+[[-i/2,-i/12],[i/2,-i/12],[i/2,i/12],[-i/2,i/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(a)():n.svg.symbol().type("square").size(a)()},fill:function(t,e){return g(e)}}),y.exit().remove()}var b=n.svg.axis().scale(v).orient("right"),x=h.select("g.legend-axis").attr({transform:"translate("+[c?e.colorBandWidth:u,u/2]+")"}).call(b);return x.selectAll(".domain").style({fill:"none",stroke:"none"}),x.selectAll("line").style({fill:"none",stroke:c?e.textColor:"none"}),x.selectAll("text").style({fill:e.textColor,"font-size":e.fontSize}).text(function(t,e){return o[e].name}),r}return r.config=function(e){return arguments.length?(i(t,e),this):t},n.rebind(r,e,"on"),r},o.Legend.defaultConfig=function(t,e){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){var n=(t=a.container.selectAll("g."+s).data([0])).enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=n.append("text").attr({dx:a.padding+l,dy:.3*+a.fontSize}),u};return u.text=function(i){var o=n.hsl(a.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=i||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(f);var h=a.padding,d=e.node().getBBox(),p={fill:a.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[a.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return i(a,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={convert:function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=i({},t);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var s=i({},t.layout);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r}};return t}},{"../../../constants/alignment":457,"../../../lib":481,d3:80}],573:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../../lib"),a=t("../../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=i.extendDeepAll,u=e.exports={};u.framework=function(t){var e,r,i,a,c,f=new s;function h(r,s){return s&&(c=s),n.select(n.select(c).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),e=e?l(e,r):r,i||(i=o.Axis()),a=o.adapter.plotly().convert(e),i.config(a).render(c),t.data=e.data,t.layout=e.layout,u.fillLayout(t),e}return h.isPolar=!0,h.svg=function(){return i.svg()},h.getConfig=function(){return e},h.getLiveConfig=function(){return o.adapter.plotly().convert(i.getLiveConfig(),!0)},h.getLiveScales=function(){return{t:i.angularScale(),r:i.radialScale()}},h.setUndoPoint=function(){var t,n,i=this,a=o.util.cloneJson(e);t=a,n=r,f.add({undo:function(){n&&i(n)},redo:function(){i(t)}}),r=o.util.cloneJson(a)},h.undo=function(){f.undo()},h.redo=function(){f.redo()},h},u.fillLayout=function(t){var e=n.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),i=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:a.background,_container:e,_paperdiv:r,_paper:i};t._fullLayout=l(o,t.layout)}},{"../../../components/color":357,"../../../lib":481,"./micropolar":572,"./undo_manager":574,d3:80}],574:[function(t,e,r){"use strict";e.exports=function(){var t,e=[],r=-1,n=!1;function i(t,e){return t?(n=!0,t[e](),n=!1,this):this}return{add:function(t){return n?this:(e.splice(r+1,e.length-r),e.push(t),r=e.length-1,this)},setCallback:function(e){t=e},undo:function(){var n=e[r];return n?(i(n,"undo"),r-=1,t&&t(n.undo),this):this},redo:function(){var n=e[r+1];return n?(i(n,"redo"),r+=1,t&&t(n.redo),this):this},clear:function(){e=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r-1&&(c[h[r]].title="");for(r=0;r")?"":e.html(t).text()});return e.remove(),r}(_),_=(_=_.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(u,"'"),i.isIE()&&(_=(_=(_=_.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),_}},{"../components/color":357,"../components/drawing":382,"../constants/xmlns_namespaces":463,"../lib":481,d3:80}],586:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/colorscale/attributes"),a=t("../../components/colorbar/attributes"),o=t("../mesh3d/attributes"),s=t("../../plots/attributes"),l=t("../../lib/extend").extendFlat,u={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},z:{valType:"data_array",editType:"calc+clearAxisTypes"},u:{valType:"data_array",editType:"calc"},v:{valType:"data_array",editType:"calc"},w:{valType:"data_array",editType:"calc"},sizemode:{valType:"enumerated",values:["scaled","absolute"],editType:"calc",dflt:"scaled"},sizeref:{valType:"number",editType:"calc",min:0},anchor:{valType:"enumerated",editType:"calc",values:["tip","tail","cm","center"],dflt:"cm"},text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"}};l(u,n("","calc",!0),{showscale:i.showscale,colorbar:a}),delete u.color;["opacity","lightposition","lighting"].forEach(function(t){u[t]=o[t]}),u.hoverinfo=l({},s.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","text","name"],dflt:"x+y+z+norm+text+name"}),e.exports=u},{"../../components/colorbar/attributes":358,"../../components/colorscale/attributes":363,"../../components/colorscale/color_attributes":365,"../../lib/extend":473,"../../plots/attributes":522,"../mesh3d/attributes":592}],587:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){for(var r=e.u,i=e.v,a=e.w,o=Math.min(r.length,i.length,a.length),s=-1/0,l=1/0,u=0;u0)u=a(t.alphahull,c);else{var d=["x","y","z"].indexOf(t.delaunayaxis);u=i(c.map(function(t){return[t[(d+1)%3],t[(d+2)%3]]}))}var p={positions:c,cells:u,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:l(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.vertexIntensityBounds=[t.cmin,t.cmax],p.colormap=s(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolor[0],p.vertexColors=f(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=f(t.facecolor)):(this.color=t.color,p.meshColor=l(t.color)),this.mesh.update(p)},c.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=function(t,e){var r=t.glplot.gl,i=n({gl:r}),a=new u(t,i,e.uid);return i._trace=a,a.update(e),t.glplot.add(i),a}},{"../../lib/gl_format_color":478,"../../lib/str2rgbarray":503,"alpha-shape":15,"convex-hull":71,"delaunay-triangulate":82,"gl-mesh3d":138}],596:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/colorscale/defaults"),o=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}function u(t){var e=t.map(function(t){var e=l(t);return e&&i.isArrayOrTypedArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var c=u(["x","y","z"]),f=u(["i","j","k"]);c?(f&&f.forEach(function(t){for(var e=0;e=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],605:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.marker,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0!==l&&l.showscale){var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,c)),n(h)||(h=i.aggNums(Math.max,null,c));var d=e[0].t.cb=s(t,u),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}else a.autoMargin(t,u)}},{"../../components/colorbar/draw":361,"../../components/colorscale":372,"../../lib":481,"../../plots/plots":568,"fast-isnumeric":90}],606:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("./subtypes");e.exports=function(t){a.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),a.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":364,"../../components/colorscale/has_colorscale":371,"./subtypes":623}],607:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20,minTolerance:.2,toleranceGrowth:10,maxScreensAway:20}},{}],608:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry"),a=t("./attributes"),o=t("./constants"),s=t("./subtypes"),l=t("./xy_defaults"),u=t("./marker_defaults"),c=t("./line_defaults"),f=t("./line_shape_defaults"),h=t("./text_defaults"),d=t("./fillcolor_defaults");e.exports=function(t,e,r,p){function g(r,i){return n.coerce(t,e,a,r,i)}var v=l(t,e,p,g),m=vU!=(R=S[k][1])>=U&&(C=S[k-1][0],P=S[k][0],R-O&&(L=C+(P-C)*(U-O)/(R-O),D=Math.min(D,L),F=Math.max(F,L)));D=Math.max(D,0),F=Math.min(F,h._length);var V=s.defaultLine;return s.opacity(f.fillcolor)?V=f.fillcolor:s.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:D,x1:F,y0:U,y1:U,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":357,"../../components/fx":399,"../../lib":481,"../../registry":577,"./fill_hover_text":609,"./get_trace_color":611}],613:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc").calc,n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style").style,n.styleOnSelect=t("./style").styleOnSelect,n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","svg","symbols","markerColorscale","errorBarsOK","showLegend","scatter-like","zoomScale"],n.meta={},e.exports=n},{"../../plots/cartesian":536,"./arrays_to_calcdata":600,"./attributes":601,"./calc":602,"./clean_data":604,"./colorbar":605,"./defaults":608,"./hover":612,"./plot":620,"./select":621,"./style":622,"./subtypes":623}],614:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,s,l){var u=(t.marker||{}).color;(s("line.color",r),i(t,"line"))?a(t,e,o,s,{prefix:"line.",cLetter:"c"}):s("line.color",!n(u)&&u||r);s("line.width"),(l||{}).noDash||s("line.dash")}},{"../../components/colorscale/defaults":367,"../../components/colorscale/has_colorscale":371,"../../lib":481}],615:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM,i=t("../../lib"),a=i.segmentsIntersect,o=i.constrain,s=t("./constants");e.exports=function(t,e){var r,l,u,c,f,h,d,p,g,v,m,y,b,x,_,w,M=e.xaxis,A=e.yaxis,T=e.simplify,k=e.connectGaps,E=e.baseTolerance,S=e.shape,L="linear"===S,C=[],P=s.minTolerance,O=new Array(t.length),R=0;function I(e){var r=t[e],i=M.c2p(r.x),a=A.c2p(r.y);return i===n||a===n?r.intoCenter||!1:[i,a]}function N(t){var e=t[0]/M._length,r=t[1]/A._length;return(1+s.toleranceGrowth*Math.max(0,-e,e-1,-r,r-1))*E}function z(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}T||(E=P=-1);var D,F,j,B,U,V,H,q=s.maxScreensAway,G=-M._length*q,X=M._length*(1+q),W=-A._length*q,Y=A._length*(1+q),Z=[[G,W,X,W],[X,W,X,Y],[X,Y,G,Y],[G,Y,G,W]];function Q(t){if(t[0]X||t[1]Y)return[o(t[0],G,X),o(t[1],W,Y)]}function J(t,e){return t[0]===e[0]&&(t[0]===G||t[0]===X)||(t[1]===e[1]&&(t[1]===W||t[1]===Y)||void 0)}function K(t,e,r){return function(n,a){var o=Q(n),s=Q(a),l=[];if(o&&s&&J(o,s))return l;o&&l.push(o),s&&l.push(s);var u=2*i.constrain((n[t]+a[t])/2,e,r)-((o||n)[t]+(s||a)[t]);u&&((o&&s?u>0==o[t]>s[t]?o:s:o||s)[t]+=u);return l}}function $(t){var e=t[0],r=t[1],n=e===O[R-1][0],i=r===O[R-1][1];if(!n||!i)if(R>1){var a=e===O[R-2][0],o=r===O[R-2][1];n&&(e===G||e===X)&&a?o?R--:O[R-1]=t:i&&(r===W||r===Y)&&o?a?R--:O[R-1]=t:O[R++]=t}else O[R++]=t}function tt(t){O[R-1][0]!==t[0]&&O[R-1][1]!==t[1]&&$([j,B]),$(t),U=null,j=B=0}function et(t){if(D=t[0]X?X:0,F=t[1]Y?Y:0,D||F){if(R)if(U){var e=H(U,t);e.length>1&&(tt(e[0]),O[R++]=e[1])}else V=H(O[R-1],t)[0],O[R++]=V;else O[R++]=[D||t[0],F||t[1]];var r=O[R-1];D&&F&&(r[0]!==D||r[1]!==F)?(U&&(j!==D&&B!==F?$(j&&B?(n=U,a=(i=t)[0]-n[0],o=(i[1]-n[1])/a,(n[1]*i[0]-i[1]*n[0])/a>0?[o>0?G:X,Y]:[o>0?X:G,W]):[j||D,B||F]):j&&B&&$([j,B])),$([D,F])):j-D&&B-F&&$([D||j,F||B]),U=t,j=D,B=F}else U&&tt(H(U,t)[0]),O[R++]=t;var n,i,a,o}for("linear"===S||"spline"===S?H=function(t,e){for(var r=[],n=0,i=0;i<4;i++){var o=Z[i],s=a(t[0],t[1],e[0],e[1],o[0],o[1],o[2],o[3]);s&&(!n||Math.abs(s.x-r[0][0])>1||Math.abs(s.y-r[0][1])>1)&&(s=[s.x,s.y],n&&z(s,t)N(h))break;u=h,(b=g[0]*p[0]+g[1]*p[1])>m?(m=b,c=h,d=!1):b=t.length||!h)break;et(h),l=h}}else et(c)}U&&$([j||U[0],B||U[1]]),C.push(O.slice(0,R))}return C}},{"../../constants/numerical":461,"../../lib":481,"./constants":607}],616:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],617:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i,a=null;for(i=0;i0?Math.max(e,i):0}}},{"fast-isnumeric":90}],619:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l,u){var c=o.isBubble(t),f=(t.line||{}).color;(u=u||{},f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noSelect||(l("selected.marker.color"),l("unselected.marker.color"),l("selected.marker.size"),l("unselected.marker.size")),u.noLine||(l("marker.line.color",f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0)),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient)&&("none"!==l("marker.gradient.type")&&l("marker.gradient.color"))}},{"../../components/color":357,"../../components/colorscale/defaults":367,"../../components/colorscale/has_colorscale":371,"./subtypes":623}],620:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../registry"),a=t("../../lib"),o=t("../../components/drawing"),s=t("./subtypes"),l=t("./line_points"),u=t("./link_traces"),c=t("../../lib/polygon").tester;function f(t,e,r,u,f,h,d){var p,g;!function(t,e,r,i,o){var l=r.xaxis,u=r.yaxis,c=n.extent(a.simpleMap(l.range,l.r2c)),f=n.extent(a.simpleMap(u.range,u.r2c)),h=i[0].trace;if(!s.hasMarkers(h))return;var d=h.marker.maxdisplayed;if(0===d)return;var p=i.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/d),v=0;o.forEach(function(t,r){var n=t[0].trace;s.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function m(t){return v?t.transition():t}var y=r.xaxis,b=r.yaxis,x=u[0].trace,_=x.line,w=n.select(h);if(i.getComponentMethod("errorbars","plot")(w,r,d),!0===x.visible){var M,A;m(w).style("opacity",x.opacity);var T=x.fill.charAt(x.fill.length-1);"x"!==T&&"y"!==T&&(T=""),r.isRangePlot||(u[0].node3=w);var k="",E=[],S=x._prevtrace;S&&(k=S._prevRevpath||"",A=S._nextFill,E=S._polygons);var L,C,P,O,R,I,N,z,D,F="",j="",B=[],U=a.noop;if(M=x._ownFill,s.hasLines(x)||"none"!==x.fill){for(A&&A.datum(u),-1!==["hv","vh","hvh","vhv"].indexOf(_.shape)?(P=o.steps(_.shape),O=o.steps(_.shape.split("").reverse().join(""))):P=O="spline"===_.shape?function(t){var e=t[t.length-1];return t.length>1&&t[0][0]===e[0]&&t[0][1]===e[1]?o.smoothclosed(t.slice(1),_.smoothing):o.smoothopen(t,_.smoothing)}:function(t){return"M"+t.join("L")},R=function(t){return O(t.reverse())},B=l(u,{xaxis:y,yaxis:b,connectGaps:x.connectgaps,baseTolerance:Math.max(_.width||1,3)/4,shape:_.shape,simplify:_.simplify}),D=x._polygons=new Array(B.length),g=0;g1){var r=n.select(this);if(r.datum(u),t)m(r.style("opacity",0).attr("d",L).call(o.lineGroupStyle)).style("opacity",1);else{var i=m(r);i.attr("d",L),o.singleLineStyle(u,i)}}}}}var V=w.selectAll(".js-line").data(B);m(V.exit()).style("opacity",0).remove(),V.each(U(!1)),V.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(o.lineGroupStyle).each(U(!0)),o.setClipUrl(V,r.layerClipId),B.length?(M?I&&z&&(T?("y"===T?I[1]=z[1]=b.c2p(0,!0):"x"===T&&(I[0]=z[0]=y.c2p(0,!0)),m(M).attr("d","M"+z+"L"+I+"L"+F.substr(1)).call(o.singleFillStyle)):m(M).attr("d",F+"Z").call(o.singleFillStyle)):A&&("tonext"===x.fill.substr(0,6)&&F&&k?("tonext"===x.fill?m(A).attr("d",F+"Z"+k+"Z").call(o.singleFillStyle):m(A).attr("d",F+"L"+k.substr(1)+"Z").call(o.singleFillStyle),x._polygons=x._polygons.concat(E)):(q(A),x._polygons=null)),x._prevRevpath=j,x._prevPolygons=D):(M?q(M):A&&q(A),x._polygons=x._prevRevpath=x._prevPolygons=null);var H=w.selectAll(".points");p=H.data([u]),H.each(Z),p.enter().append("g").classed("points",!0).each(Z),p.exit().remove(),p.each(function(t){var e=!1===t[0].trace.cliponaxis;o.setClipUrl(n.select(this),e?null:r.layerClipId)})}function q(t){m(t).attr("d","M0,0Z")}function G(t){return t.filter(function(t){return t.vis})}function X(t){return t.id}function W(t){if(t.ids)return X}function Y(){return!1}function Z(e){var i,l=e[0].trace,u=n.select(this),c=s.hasMarkers(l),f=s.hasText(l),h=W(l),d=Y,p=Y;c&&(d=l.marker.maxdisplayed||l._needsCull?G:a.identity),f&&(p=l.marker.maxdisplayed||l._needsCull?G:a.identity);var g,x=(i=u.selectAll("path.point").data(d,h)).enter().append("path").classed("point",!0);v&&x.call(o.pointStyle,l,t).call(o.translatePoints,y,b).style("opacity",0).transition().style("opacity",1),i.order(),c&&(g=o.makePointStyleFns(l)),i.each(function(e){var i=n.select(this),a=m(i);o.translatePoint(e,a,y,b)?(o.singlePointStyle(e,a,l,g,t),r.layerClipId&&o.hideOutsideRangePoint(e,a,y,b,l.xcalendar,l.ycalendar),l.customdata&&i.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()}),v?i.exit().transition().style("opacity",0).remove():i.exit().remove(),(i=u.selectAll("g").data(p,h)).enter().append("g").classed("textpoint",!0).append("text"),i.order(),i.each(function(t){var e=n.select(this),i=m(e.select("text"));o.translatePoint(t,i,y,b)?r.layerClipId&&o.hideOutsideRangePoint(t,e,y,b,l.xcalendar,l.ycalendar):e.remove()}),i.selectAll("text").call(o.textPointStyle,l,t).each(function(t){var e=y.c2p(t.x),r=b.c2p(t.y);n.select(this).selectAll("tspan.line").each(function(){m(n.select(this)).attr({x:e,y:r})})}),i.exit().remove()}}e.exports=function(t,e,r,i,a,s){var l,c,h,d,p=!a,g=!!a&&a.duration>0;for((h=i.selectAll("g.trace").data(r,function(t){return t[0].trace.uid})).enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),u(t,e,r),function(t,e,r){var i;e.selectAll("g.trace").each(function(t){var e=n.select(this);if((i=t[0].trace)._nexttrace){if(i._nextFill=e.select(".js-fill.js-tonext"),!i._nextFill.size()){var a=":first-child";e.select(".js-fill.js-tozero").size()&&(a+=" + *"),i._nextFill=e.insert("path",a).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),i._nextFill=null;i.fill&&("tozero"===i.fill.substr(0,6)||"toself"===i.fill||"to"===i.fill.substr(0,2)&&!i._prevtrace)?(i._ownFill=e.select(".js-fill.js-tozero"),i._ownFill.size()||(i._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),i._ownFill=null),e.selectAll(".js-fill").call(o.setClipUrl,r.layerClipId)})}(0,i,e),l=0,c={};lc[e[0].trace.uid]?1:-1}),g)?(s&&(d=s()),n.transition().duration(a.duration).ease(a.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).each(function(){i.selectAll("g.trace").each(function(n,i){f(t,i,e,n,r,this,a)})})):i.selectAll("g.trace").each(function(n,i){f(t,i,e,n,r,this,a)});p&&h.exit().remove(),i.selectAll("path:not([d])").remove()}},{"../../components/drawing":382,"../../lib":481,"../../lib/polygon":493,"../../registry":577,"./line_points":615,"./link_traces":617,"./subtypes":623,d3:80}],621:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],f=s[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===e)for(r=0;r=0&&(d[1]+=1),h.indexOf("top")>=0&&(d[1]-=1),h.indexOf("left")>=0&&(d[0]-=1),h.indexOf("right")>=0&&(d[0]+=1),d)),r.textColor=c(e.textfont,1,L),r.textSize=b(e.textfont.size,L,l.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var I=["x","y","z"];for(r.project=[!1,!1,!1],r.projectScale=[1,1,1],r.projectOpacity=[1,1,1],n=0;n<3;++n){var N=e.projection[I[n]];(r.project[n]=N.show)&&(r.projectOpacity[n]=N.opacity,r.projectScale[n]=N.scale)}r.errorBounds=p(e,x);var z=function(t){for(var e=[0,0,0],r=[[0,0,0],[0,0,0],[0,0,0]],n=[0,0,0],i=0;i<3;i++){var a=t[i];a&&!1!==a.copy_zstyle&&(a=t[2]),a&&(e[i]=a.width/2,r[i]=u(a.color),n=a.thickness)}return{capSize:e,color:r,lineWidth:n}}([e.error_x,e.error_y,e.error_z]);return r.errorColor=z.color,r.errorLineWidth=z.lineWidth,r.errorCapSize=z.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=u(e.surfacecolor),r}function _(t){if(Array.isArray(t)){var e=t[0];return Array.isArray(e)&&(t=e),"rgb("+t.slice(0,3).map(function(t){return Math.round(255*t)})+")"}return null}v.handlePick=function(t){if(t.object&&(t.object===this.linePlot||t.object===this.delaunayMesh||t.object===this.textMarkers||t.object===this.scatterPlot)){t.object.highlight&&t.object.highlight(null),this.scatterPlot&&(t.object=this.scatterPlot,this.scatterPlot.highlight(t.data)),this.textLabels?void 0!==this.textLabels[t.data.index]?t.textLabel=this.textLabels[t.data.index]:t.textLabel=this.textLabels:t.textLabel="";var e=t.index=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},v.update=function(t){var e,r,l,u,c=this.scene.glplot.gl,f=h.solid;this.data=t;var d=x(this.scene,t);"mode"in d&&(this.mode=d.mode),"lineDashes"in d&&d.lineDashes in h&&(f=h[d.lineDashes]),this.color=_(d.scatterColor)||_(d.lineColor),this.dataPoints=d.position,e={gl:c,position:d.position,color:d.lineColor,lineWidth:d.lineWidth||1,dashes:f[0],dashScale:f[1],opacity:t.opacity,connectGaps:t.connectgaps},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=n(e),this.linePlot._trace=this,this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var p=t.opacity;if(t.marker&&t.marker.opacity&&(p*=t.marker.opacity),r={gl:c,position:d.position,color:d.scatterColor,size:d.scatterSize,glyph:d.scatterMarker,opacity:p,orthographic:!0,lineWidth:d.scatterLineWidth,lineColor:d.scatterLineColor,project:d.project,projectScale:d.projectScale,projectOpacity:d.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=i(r),this.scatterPlot._trace=this,this.scatterPlot.highlightScale=1,this.scene.glplot.add(this.scatterPlot)):this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose(),this.scatterPlot=null),u={gl:c,position:d.position,glyph:d.text,color:d.textColor,size:d.textSize,angle:d.textAngle,alignment:d.textOffset,font:d.textFont,orthographic:!0,lineWidth:0,project:!1,opacity:t.opacity},this.textLabels=t.hovertext||t.text,-1!==this.mode.indexOf("text")?this.textMarkers?this.textMarkers.update(u):(this.textMarkers=i(u),this.textMarkers._trace=this,this.textMarkers.highlightScale=1,this.scene.glplot.add(this.textMarkers)):this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose(),this.textMarkers=null),l={gl:c,position:d.position,color:d.errorColor,error:d.errorBounds,lineWidth:d.errorLineWidth,capSize:d.errorCapSize,opacity:t.opacity},this.errorBars?d.errorBounds?this.errorBars.update(l):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):d.errorBounds&&(this.errorBars=a(l),this.errorBars._trace=this,this.scene.glplot.add(this.errorBars)),d.delaunayAxis>=0){var g=function(t,e,r){var n,i=(r+1)%3,a=(r+2)%3,o=[],l=[];for(n=0;n=0&&f("surfacecolor",h||d);for(var p=["x","y","z"],g=0;g<3;++g){var v="projection."+p[g];f(v+".show")&&(f(v+".opacity"),f(v+".scale"))}var m=n.getComponentMethod("errorbars","supplyDefaults");m(t,e,r,{axis:"z"}),m(t,e,r,{axis:"y",inherit:"z"}),m(t,e,r,{axis:"x",inherit:"z"})}else e.visible=!1}},{"../../lib":481,"../../registry":577,"../scatter/line_defaults":614,"../scatter/marker_defaults":619,"../scatter/subtypes":623,"../scatter/text_defaults":624,"./attributes":626}],631:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl3d_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl3d_markers":459,"../../plots/gl3d":555,"../scatter/colorbar":605,"./attributes":626,"./calc":627,"./convert":629,"./defaults":630}],632:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/attributes"),a=t("../../components/colorbar/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll;function u(t){return{show:{valType:"boolean",dflt:!1},project:{x:{valType:"boolean",dflt:!1},y:{valType:"boolean",dflt:!1},z:{valType:"boolean",dflt:!1}},color:{valType:"color",dflt:n.defaultLine},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!0},highlightcolor:{valType:"color",dflt:n.defaultLine},highlightwidth:{valType:"number",min:1,max:16,dflt:2}}}var c=e.exports=l({z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},surfacecolor:{valType:"data_array"},cauto:i.zauto,cmin:i.zmin,cmax:i.zmax,colorscale:i.colorscale,autocolorscale:s({},i.autocolorscale,{dflt:!1}),reversescale:i.reversescale,showscale:i.showscale,colorbar:a,contours:{x:u(),y:u(),z:u()},hidesurface:{valType:"boolean",dflt:!1},lightposition:{x:{valType:"number",min:-1e5,max:1e5,dflt:10},y:{valType:"number",min:-1e5,max:1e5,dflt:1e4},z:{valType:"number",min:-1e5,max:1e5,dflt:0}},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05},roughness:{valType:"number",min:0,max:1,dflt:.5},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},_deprecated:{zauto:s({},i.zauto,{}),zmin:s({},i.zmin,{}),zmax:s({},i.zmax,{})},hoverinfo:s({},o.hoverinfo)},"calc","nested");c.x.editType=c.y.editType=c.z.editType="calc+clearAxisTypes"},{"../../components/color":357,"../../components/colorbar/attributes":358,"../../components/colorscale/attributes":363,"../../lib/extend":473,"../../plot_api/edit_types":510,"../../plots/attributes":522}],633:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.surfacecolor?n(e,e.surfacecolor,"","c"):n(e,e.z,"","c")}},{"../../components/colorscale/calc":364}],634:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l="cb"+r.uid,u=r.cmin,c=r.cmax,f=r.surfacecolor||r.z;if(n(u)||(u=i.aggNums(Math.min,null,f)),n(c)||(c=i.aggNums(Math.max,null,f)),t._fullLayout._infolayer.selectAll("."+l).remove(),r.showscale){var h=e[0].t.cb=s(t,l),d=o.makeColorScaleFunc(o.extractScale(r.colorscale,u,c),{noNumericCheck:!0});h.fillcolor(d).filllevels({start:u,end:c,size:(c-u)/254}).options(r.colorbar)()}else a.autoMargin(t,l)}},{"../../components/colorbar/draw":361,"../../components/colorscale":372,"../../lib":481,"../../plots/plots":568,"fast-isnumeric":90}],635:[function(t,e,r){"use strict";var n=t("gl-surface3d"),i=t("ndarray"),a=t("ndarray-homography"),o=t("ndarray-fill"),s=t("ndarray-ops"),l=t("../../lib").isArrayOrTypedArray,u=t("../../lib/gl_format_color").parseColorScale,c=t("../../lib/str2rgbarray"),f=128;function h(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.dataScale=1}var d=h.prototype;function p(t){var e=t.shape,r=[e[0]+2,e[1]+2],n=i(new Float32Array(r[0]*r[1]),r);return s.assign(n.lo(1,1).hi(e[0],e[1]),t),s.assign(n.lo(1).hi(e[0],1),t.hi(e[0],1)),s.assign(n.lo(1,r[1]-1).hi(e[0],1),t.lo(0,e[1]-1).hi(e[0],1)),s.assign(n.lo(0,1).hi(1,e[1]),t.hi(1)),s.assign(n.lo(r[0]-1,1).hi(1,e[1]),t.lo(e[0]-1)),n.set(0,0,t.get(0,0)),n.set(0,r[1]-1,t.get(0,e[1]-1)),n.set(r[0]-1,0,t.get(e[0]-1,0)),n.set(r[0]-1,r[1]-1,t.get(e[0]-1,e[1]-1)),n}d.handlePick=function(t){if(t.object===this.surface){var e=t.index=[Math.min(0|Math.round(t.data.index[0]/this.dataScale-1),this.data.z[0].length-1),Math.min(0|Math.round(t.data.index[1]/this.dataScale-1),this.data.z.length-1)],r=[0,0,0];l(this.data.x)?l(this.data.x[0])?r[0]=this.data.x[e[1]][e[0]]:r[0]=this.data.x[e[0]]:r[0]=e[0],l(this.data.y)?l(this.data.y[0])?r[1]=this.data.y[e[1]][e[0]]:r[1]=this.data.y[e[1]]:r[1]=e[1],r[2]=this.data.z[e[1]][e[0]],t.traceCoordinate=r;var n=this.scene.fullSceneLayout;t.dataCoordinate=[n.xaxis.d2l(r[0],0,this.data.xcalendar)*this.scene.dataScale[0],n.yaxis.d2l(r[1],0,this.data.ycalendar)*this.scene.dataScale[1],n.zaxis.d2l(r[2],0,this.data.zcalendar)*this.scene.dataScale[2]];var i=this.data.text;return Array.isArray(i)&&i[e[1]]&&void 0!==i[e[1]][e[0]]?t.textLabel=i[e[1]][e[0]]:t.textLabel=i||"",t.data.dataCoordinate=t.dataCoordinate.slice(),this.surface.highlight(t.data),this.scene.glplot.spikes.position=t.dataCoordinate,!0}},d.setContourLevels=function(){for(var t=[[],[],[]],e=!1,r=0;r<3;++r)this.showContour[r]&&(e=!0,t[r]=this.scene.contourLevels[r]);e&&this.surface.update({levels:t})},d.update=function(t){var e,r=this.scene,n=r.fullSceneLayout,s=this.surface,h=t.opacity,d=u(t.colorscale,h),g=t.z,v=t.x,m=t.y,y=n.xaxis,b=n.yaxis,x=n.zaxis,_=r.dataScale,w=g[0].length,M=t._ylength,A=[i(new Float32Array(w*M),[w,M]),i(new Float32Array(w*M),[w,M]),i(new Float32Array(w*M),[w,M])],T=A[0],k=A[1],E=r.contourLevels;this.data=t;var S=t.xcalendar,L=t.ycalendar,C=t.zcalendar;o(A[2],function(t,e){return x.d2l(g[e][t],0,C)*_[2]}),l(v)?l(v[0])?o(T,function(t,e){return y.d2l(v[e][t],0,S)*_[0]}):o(T,function(t){return y.d2l(v[t],0,S)*_[0]}):o(T,function(t){return y.d2l(t,0,S)*_[0]}),l(v)?l(m[0])?o(k,function(t,e){return b.d2l(m[e][t],0,L)*_[1]}):o(k,function(t,e){return b.d2l(m[e],0,L)*_[1]}):o(k,function(t,e){return b.d2l(e,0,S)*_[1]});var P={colormap:d,levels:[[],[],[]],showContour:[!0,!0,!0],showSurface:!t.hidesurface,contourProject:[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],contourWidth:[1,1,1],contourColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],contourTint:[1,1,1],dynamicColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],dynamicWidth:[1,1,1],dynamicTint:[1,1,1],opacity:t.opacity};if(P.intensityBounds=[t.cmin,t.cmax],t.surfacecolor){var O=i(new Float32Array(w*M),[w,M]);o(O,function(e,r){return t.surfacecolor[r][e]}),A.push(O)}else P.intensityBounds[0]*=_[2],P.intensityBounds[1]*=_[2];this.dataScale=function(t){var e=Math.max(t[0].shape[0],t[0].shape[1]);if(e:not(.watermark)":"opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;","X:hover .modebar--hover .modebar-group":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar.vertical":"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;","X .modebar.vertical svg":"top:-1px;","X .modebar.vertical .modebar-group":"display:block;float:none;padding-left:0px;padding-bottom:8px;","X .modebar.vertical .modebar-group .modebar-btn":"display:block;text-align:center;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":"content:'';position:absolute;background:transparent;border:6px solid transparent;z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;","X [data-title]:after":"content:attr(data-title);background:#69738a;color:white;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .vertical [data-title]:before,X .vertical [data-title]:after":"top:0%;right:200%;","X .vertical [data-title]:before":"border:6px solid transparent;border-left-color:#69738a;margin-top:8px;margin-right:-30px;","X .select-outline":"fill:none;stroke-width:1;shape-rendering:crispEdges;","X .select-outline-1":"stroke:white;","X .select-outline-2":"stroke:black;stroke-dasharray:2px 2px;",Y:"font-family:'Open Sans';position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;","Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,0.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","Y .notifier-close":"color:#fff;opacity:0.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var a in i){var o=a.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,i[a])}},{"../src/lib":495}],2:[function(t,e,r){"use strict";e.exports={undo:{width:857.1,height:1e3,path:"m857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z",transform:"matrix(1 0 0 -1 0 850)"},home:{width:928.6,height:1e3,path:"m786 296v-267q0-15-11-26t-25-10h-214v214h-143v-214h-214q-15 0-25 10t-11 26v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-4-7 2-12 7l-35 41q-4 5-3 13t6 12l401 334q18 15 42 15t43-15l136-114v109q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q5-5 6-12t-4-13z",transform:"matrix(1 0 0 -1 0 850)"},"camera-retro":{width:1e3,height:1e3,path:"m518 386q0 8-5 13t-13 5q-37 0-63-27t-26-63q0-8 5-13t13-5 12 5 5 13q0 23 16 38t38 16q8 0 13 5t5 13z m125-73q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m-572-320h858v71h-858v-71z m643 320q0 89-62 152t-152 62-151-62-63-152 63-151 151-63 152 63 62 151z m-571 358h214v72h-214v-72z m-72-107h858v143h-462l-36-71h-360v-72z m929 143v-714q0-30-21-51t-50-21h-858q-29 0-50 21t-21 51v714q0 30 21 51t50 21h858q29 0 50-21t21-51z",transform:"matrix(1 0 0 -1 0 850)"},zoombox:{width:1e3,height:1e3,path:"m1000-25l-250 251c40 63 63 138 63 218 0 224-182 406-407 406-224 0-406-182-406-406s183-406 407-406c80 0 155 22 218 62l250-250 125 125z m-812 250l0 438 437 0 0-438-437 0z m62 375l313 0 0-312-313 0 0 312z",transform:"matrix(1 0 0 -1 0 850)"},pan:{width:1e3,height:1e3,path:"m1000 350l-187 188 0-125-250 0 0 250 125 0-188 187-187-187 125 0 0-250-250 0 0 125-188-188 186-187 0 125 252 0 0-250-125 0 187-188 188 188-125 0 0 250 250 0 0-126 187 188z",transform:"matrix(1 0 0 -1 0 850)"},zoom_plus:{width:875,height:1e3,path:"m1 787l0-875 875 0 0 875-875 0z m687-500l-187 0 0-187-125 0 0 187-188 0 0 125 188 0 0 187 125 0 0-187 187 0 0-125z",transform:"matrix(1 0 0 -1 0 850)"},zoom_minus:{width:875,height:1e3,path:"m0 788l0-876 875 0 0 876-875 0z m688-500l-500 0 0 125 500 0 0-125z",transform:"matrix(1 0 0 -1 0 850)"},autoscale:{width:1e3,height:1e3,path:"m250 850l-187 0-63 0 0-62 0-188 63 0 0 188 187 0 0 62z m688 0l-188 0 0-62 188 0 0-188 62 0 0 188 0 62-62 0z m-875-938l0 188-63 0 0-188 0-62 63 0 187 0 0 62-187 0z m875 188l0-188-188 0 0-62 188 0 62 0 0 62 0 188-62 0z m-125 188l-1 0-93-94-156 156 156 156 92-93 2 0 0 250-250 0 0-2 93-92-156-156-156 156 94 92 0 2-250 0 0-250 0 0 93 93 157-156-157-156-93 94 0 0 0-250 250 0 0 0-94 93 156 157 156-157-93-93 0 0 250 0 0 250z",transform:"matrix(1 0 0 -1 0 850)"},tooltip_basic:{width:1500,height:1e3,path:"m375 725l0 0-375-375 375-374 0-1 1125 0 0 750-1125 0z",transform:"matrix(1 0 0 -1 0 850)"},tooltip_compare:{width:1125,height:1e3,path:"m187 786l0 2-187-188 188-187 0 0 937 0 0 373-938 0z m0-499l0 1-187-188 188-188 0 0 937 0 0 376-938-1z",transform:"matrix(1 0 0 -1 0 850)"},plotlylogo:{width:1542,height:1e3,path:"m0-10h182v-140h-182v140z m228 146h183v-286h-183v286z m225 714h182v-1000h-182v1000z m225-285h182v-715h-182v715z m225 142h183v-857h-183v857z m231-428h182v-429h-182v429z m225-291h183v-138h-183v138z",transform:"matrix(1 0 0 -1 0 850)"},"z-axis":{width:1e3,height:1e3,path:"m833 5l-17 108v41l-130-65 130-66c0 0 0 38 0 39 0-1 36-14 39-25 4-15-6-22-16-30-15-12-39-16-56-20-90-22-187-23-279-23-261 0-341 34-353 59 3 60 228 110 228 110-140-8-351-35-351-116 0-120 293-142 474-142 155 0 477 22 477 142 0 50-74 79-163 96z m-374 94c-58-5-99-21-99-40 0-24 65-43 144-43 79 0 143 19 143 43 0 19-42 34-98 40v216h87l-132 135-133-135h88v-216z m167 515h-136v1c16 16 31 34 46 52l84 109v54h-230v-71h124v-1c-16-17-28-32-44-51l-89-114v-51h245v72z",transform:"matrix(1 0 0 -1 0 850)"},"3d_rotate":{width:1e3,height:1e3,path:"m922 660c-5 4-9 7-14 11-359 263-580-31-580-31l-102 28 58-400c0 1 1 1 2 2 118 108 351 249 351 249s-62 27-100 42c88 83 222 183 347 122 16-8 30-17 44-27-2 1-4 2-6 4z m36-329c0 0 64 229-88 296-62 27-124 14-175-11 157-78 225-208 249-266 8-19 11-31 11-31 2 5 6 15 11 32-5-13-8-20-8-20z m-775-239c70-31 117-50 198-32-121 80-199 346-199 346l-96-15-58-12c0 0 55-226 155-287z m603 133l-317-139c0 0 4-4 19-14 7-5 24-15 24-15s-177-147-389 4c235-287 536-112 536-112l31-22 100 299-4-1z m-298-153c6-4 14-9 24-15 0 0-17 10-24 15z",transform:"matrix(1 0 0 -1 0 850)"},camera:{width:1e3,height:1e3,path:"m500 450c-83 0-150-67-150-150 0-83 67-150 150-150 83 0 150 67 150 150 0 83-67 150-150 150z m400 150h-120c-16 0-34 13-39 29l-31 93c-6 15-23 28-40 28h-340c-16 0-34-13-39-28l-31-94c-6-15-23-28-40-28h-120c-55 0-100-45-100-100v-450c0-55 45-100 100-100h800c55 0 100 45 100 100v450c0 55-45 100-100 100z m-400-550c-138 0-250 112-250 250 0 138 112 250 250 250 138 0 250-112 250-250 0-138-112-250-250-250z m365 380c-19 0-35 16-35 35 0 19 16 35 35 35 19 0 35-16 35-35 0-19-16-35-35-35z",transform:"matrix(1 0 0 -1 0 850)"},movie:{width:1e3,height:1e3,path:"m938 413l-188-125c0 37-17 71-44 94 64 38 107 107 107 187 0 121-98 219-219 219-121 0-219-98-219-219 0-61 25-117 66-156h-115c30 33 49 76 49 125 0 103-84 187-187 187s-188-84-188-187c0-57 26-107 65-141-38-22-65-62-65-109v-250c0-70 56-126 125-126h500c69 0 125 56 125 126l188-126c34 0 62 28 62 63v375c0 35-28 63-62 63z m-750 0c-69 0-125 56-125 125s56 125 125 125 125-56 125-125-56-125-125-125z m406-1c-87 0-157 70-157 157 0 86 70 156 157 156s156-70 156-156-70-157-156-157z",transform:"matrix(1 0 0 -1 0 850)"},question:{width:857.1,height:1e3,path:"m500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-14 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-16-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z",transform:"matrix(1 0 0 -1 0 850)"},disk:{width:857.1,height:1e3,path:"m214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-8 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z",transform:"matrix(1 0 0 -1 0 850)"},lasso:{width:1031,height:1e3,path:"m1018 538c-36 207-290 336-568 286-277-48-473-256-436-463 10-57 36-108 76-151-13-66 11-137 68-183 34-28 75-41 114-42l-55-70 0 0c-2-1-3-2-4-3-10-14-8-34 5-45 14-11 34-8 45 4 1 1 2 3 2 5l0 0 113 140c16 11 31 24 45 40 4 3 6 7 8 11 48-3 100 0 151 9 278 48 473 255 436 462z m-624-379c-80 14-149 48-197 96 42 42 109 47 156 9 33-26 47-66 41-105z m-187-74c-19 16-33 37-39 60 50-32 109-55 174-68-42-25-95-24-135 8z m360 75c-34-7-69-9-102-8 8 62-16 128-68 170-73 59-175 54-244-5-9 20-16 40-20 61-28 159 121 317 333 354s407-60 434-217c28-159-121-318-333-355z",transform:"matrix(1 0 0 -1 0 850)"},selectbox:{width:1e3,height:1e3,path:"m0 850l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-285l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z",transform:"matrix(1 0 0 -1 0 850)"},spikeline:{width:1e3,height:1e3,path:"M512 409c0-57-46-104-103-104-57 0-104 47-104 104 0 57 47 103 104 103 57 0 103-46 103-103z m-327-39l92 0 0 92-92 0z m-185 0l92 0 0 92-92 0z m370-186l92 0 0 93-92 0z m0-184l92 0 0 92-92 0z",transform:"matrix(1.5 0 0 -1.5 0 850)"},newplotlylogo:{name:"newplotlylogo",svg:"plotly-logomark"}}},{}],3:[function(t,e,r){"use strict";e.exports=t("../src/traces/cone")},{"../src/traces/cone":605}],4:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":477}],5:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./scatter3d"),t("./surface"),t("./mesh3d"),t("./cone"),t("./streamtube")]),e.exports=n},{"./cone":3,"./core":4,"./mesh3d":6,"./scatter3d":7,"./streamtube":8,"./surface":9}],6:[function(t,e,r){"use strict";e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":612}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":648}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/streamtube")},{"../src/traces/streamtube":653}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/surface")},{"../src/traces/surface":658}],10:[function(t,e,r){"use strict";e.exports=function(t){var e=(t=t||{}).eye||[0,0,1],r=t.center||[0,0,0],s=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=n(),f=i(),h=a();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,s),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,s),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,s),new o({turntable:c,orbit:f,matrix:h},u)};var n=t("turntable-camera-controller"),i=t("orbit-camera-controller"),a=t("matrix-camera-controller");function o(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}var s=o.prototype;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].forEach(function(t){for(var e=t[0],r=[],n=0;n0?n-4:n,f=0;f>16&255,s[l++]=e>>8&255,s[l++]=255&e;2===o&&(e=i[t.charCodeAt(f)]<<2|i[t.charCodeAt(f+1)]>>4,s[l++]=255&e);1===o&&(e=i[t.charCodeAt(f)]<<10|i[t.charCodeAt(f+1)]<<4|i[t.charCodeAt(f+2)]>>2,s[l++]=e>>8&255,s[l++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,a=[],o=0,s=r-i;os?s:o+16383));1===i?(e=t[r-1],a.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],a.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return a.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,a,o=[],s=e;s>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],19:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}},{"./lib/rationalize":29}],20:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],21:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]),t[1].mul(e[0]))}},{"./lib/rationalize":29}],22:[function(t,e,r){"use strict";var n=t("./is-rat"),i=t("./lib/is-bn"),a=t("./lib/num-to-bn"),o=t("./lib/str-to-bn"),s=t("./lib/rationalize"),l=t("./div");e.exports=function t(e,r){if(n(e))return r?l(e,t(r)):[e[0].clone(),e[1].clone()];var u=0;var c,f;if(i(e))c=e.clone();else if("string"==typeof e)c=o(e);else{if(0===e)return[a(0),a(1)];if(e===Math.floor(e))c=a(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),u-=256;c=a(e)}}if(n(r))c.mul(r[1]),f=r[0].clone();else if(i(r))f=r.clone();else if("string"==typeof r)f=o(r);else if(r)if(r===Math.floor(r))f=a(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),u+=256;f=a(r)}else f=a(1);u>0?c=c.ushln(u):u<0&&(f=f.ushln(-u));return s(c,f)}},{"./div":21,"./is-rat":23,"./lib/is-bn":27,"./lib/num-to-bn":28,"./lib/rationalize":29,"./lib/str-to-bn":30}],23:[function(t,e,r){"use strict";var n=t("./lib/is-bn");e.exports=function(t){return Array.isArray(t)&&2===t.length&&n(t[0])&&n(t[1])}},{"./lib/is-bn":27}],24:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":37}],25:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=function(t){var e=t.length,r=t.words,i=0;if(1===e)i=r[0];else if(2===e)i=r[0]+67108864*r[1];else for(var a=0;a20)return 52;return r+32}},{"bit-twiddle":36,"double-bits":84}],27:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":37}],28:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("double-bits");e.exports=function(t){var e=i.exponent(t);return e<52?new n(t):new n(t*Math.pow(2,52-e)).ushln(e-52)}},{"bn.js":37,"double-bits":84}],29:[function(t,e,r){"use strict";var n=t("./num-to-bn"),i=t("./bn-sign");e.exports=function(t,e){var r=i(t),a=i(e);if(0===r)return[n(0),n(1)];if(0===a)return[n(0),n(0)];a<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);if(o.cmpn(1))return[t.div(o),e.div(o)];return[t,e]}},{"./bn-sign":24,"./num-to-bn":28}],30:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":37}],31:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[0]),t[1].mul(e[1]))}},{"./lib/rationalize":29}],32:[function(t,e,r){"use strict";var n=t("./lib/bn-sign");e.exports=function(t){return n(t[0])*n(t[1])}},{"./lib/bn-sign":24}],33:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}},{"./lib/rationalize":29}],34:[function(t,e,r){"use strict";var n=t("./lib/bn-to-num"),i=t("./lib/ctz");e.exports=function(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var a=e.abs().divmod(r.abs()),o=a.div,s=n(o),l=a.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=i(s)+4,f=n(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}var h=r.bitLength()-l.bitLength()+53,f=n(l.ushln(h).divRound(r));return h<1023?u*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),u*f*Math.pow(2,1023-h))}},{"./lib/bn-to-num":25,"./lib/ctz":26}],35:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=["function ",t,"(a,l,h,",n.join(","),"){",a?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return a?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),a?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],36:[function(t,e,r){"use strict";function n(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,e|=r=((t>>>=e)>255)<<3,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},r.deinterleave2=function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},r.interleave3=function(t,e,r){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},r.deinterleave3=function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],37:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;try{o=t("buffer").Buffer}catch(t){}function s(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function l(t,e,r,n){for(var i=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return i}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=s(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,s=Math.min(a,a-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&l,h=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=h;d++){var p=u-d|0;c+=(o=(i=0|t.words[p])*(a=0|e.words[d])+f)/67108864|0,f=67108863&o}r.words[u]=0|f,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,a=0,o=0;o>>24-i&16777215)||o!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=c[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:u[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n("undefined"!=typeof o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(a),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,g=d>>>13,v=0|o[2],m=8191&v,y=v>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],A=8191&w,M=w>>>13,T=0|o[5],k=8191&T,E=T>>>13,L=0|o[6],S=8191&L,C=L>>>13,O=0|o[7],R=8191&O,P=O>>>13,z=0|o[8],I=8191&z,N=z>>>13,D=0|o[9],F=8191&D,j=D>>>13,B=0|s[0],U=8191&B,V=B>>>13,H=0|s[1],q=8191&H,G=H>>>13,X=0|s[2],W=8191&X,Y=X>>>13,Z=0|s[3],Q=8191&Z,$=Z>>>13,J=0|s[4],K=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ft=8191&ct,ht=ct>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(u+(n=Math.imul(f,U))|0)+((8191&(i=(i=Math.imul(f,V))+Math.imul(h,U)|0))<<13)|0;u=((a=Math.imul(h,V))+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,V))+Math.imul(g,U)|0,a=Math.imul(g,V);var mt=(u+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(h,q)|0))<<13)|0;u=((a=a+Math.imul(h,G)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,U),i=(i=Math.imul(m,V))+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,q)|0,a=a+Math.imul(g,G)|0;var yt=(u+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(h,W)|0))<<13)|0;u=((a=a+Math.imul(h,Y)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,V))+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(m,q)|0,i=(i=i+Math.imul(m,G)|0)+Math.imul(y,q)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,W)|0,a=a+Math.imul(g,Y)|0;var bt=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,$)|0)+Math.imul(h,Q)|0))<<13)|0;u=((a=a+Math.imul(h,$)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,U),i=(i=Math.imul(A,V))+Math.imul(M,U)|0,a=Math.imul(M,V),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(_,q)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(y,W)|0,a=a+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,$)|0;var xt=(u+(n=n+Math.imul(f,K)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(h,K)|0))<<13)|0;u=((a=a+Math.imul(h,tt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(k,U),i=(i=Math.imul(k,V))+Math.imul(E,U)|0,a=Math.imul(E,V),n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(M,q)|0,a=a+Math.imul(M,G)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(_,W)|0,a=a+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,$)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,$)|0,n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,K)|0,a=a+Math.imul(g,tt)|0;var _t=(u+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(h,rt)|0))<<13)|0;u=((a=a+Math.imul(h,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(S,U),i=(i=Math.imul(S,V))+Math.imul(C,U)|0,a=Math.imul(C,V),n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(E,q)|0,a=a+Math.imul(E,G)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(M,W)|0,a=a+Math.imul(M,Y)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,$)|0,n=n+Math.imul(m,K)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(y,K)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,nt)|0;var wt=(u+(n=n+Math.imul(f,at)|0)|0)+((8191&(i=(i=i+Math.imul(f,ot)|0)+Math.imul(h,at)|0))<<13)|0;u=((a=a+Math.imul(h,ot)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(R,U),i=(i=Math.imul(R,V))+Math.imul(P,U)|0,a=Math.imul(P,V),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(C,q)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(k,W)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(E,W)|0,a=a+Math.imul(E,Y)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,$)|0)+Math.imul(M,Q)|0,a=a+Math.imul(M,$)|0,n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(_,K)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(p,at)|0,i=(i=i+Math.imul(p,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0;var At=(u+(n=n+Math.imul(f,lt)|0)|0)+((8191&(i=(i=i+Math.imul(f,ut)|0)+Math.imul(h,lt)|0))<<13)|0;u=((a=a+Math.imul(h,ut)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(I,U),i=(i=Math.imul(I,V))+Math.imul(N,U)|0,a=Math.imul(N,V),n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,G)|0)+Math.imul(P,q)|0,a=a+Math.imul(P,G)|0,n=n+Math.imul(S,W)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(C,W)|0,a=a+Math.imul(C,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,$)|0,n=n+Math.imul(A,K)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(M,K)|0,a=a+Math.imul(M,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(m,at)|0,i=(i=i+Math.imul(m,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ut)|0)+Math.imul(g,lt)|0,a=a+Math.imul(g,ut)|0;var Mt=(u+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(h,ft)|0))<<13)|0;u=((a=a+Math.imul(h,ht)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,V))+Math.imul(j,U)|0,a=Math.imul(j,V),n=n+Math.imul(I,q)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(N,q)|0,a=a+Math.imul(N,G)|0,n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(P,W)|0,a=a+Math.imul(P,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,$)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,$)|0,n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(E,K)|0,a=a+Math.imul(E,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,nt)|0,n=n+Math.imul(x,at)|0,i=(i=i+Math.imul(x,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(m,lt)|0,i=(i=i+Math.imul(m,ut)|0)+Math.imul(y,lt)|0,a=a+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ft)|0,a=a+Math.imul(g,ht)|0;var Tt=(u+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,gt)|0)+Math.imul(h,pt)|0))<<13)|0;u=((a=a+Math.imul(h,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,q),i=(i=Math.imul(F,G))+Math.imul(j,q)|0,a=Math.imul(j,G),n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(N,W)|0,a=a+Math.imul(N,Y)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(P,Q)|0,a=a+Math.imul(P,$)|0,n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(C,K)|0,a=a+Math.imul(C,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,nt)|0,n=n+Math.imul(A,at)|0,i=(i=i+Math.imul(A,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ut)|0)+Math.imul(_,lt)|0,a=a+Math.imul(_,ut)|0,n=n+Math.imul(m,ft)|0,i=(i=i+Math.imul(m,ht)|0)+Math.imul(y,ft)|0,a=a+Math.imul(y,ht)|0;var kt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;u=((a=a+Math.imul(g,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,W),i=(i=Math.imul(F,Y))+Math.imul(j,W)|0,a=Math.imul(j,Y),n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(N,Q)|0,a=a+Math.imul(N,$)|0,n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(P,K)|0,a=a+Math.imul(P,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(C,rt)|0,a=a+Math.imul(C,nt)|0,n=n+Math.imul(k,at)|0,i=(i=i+Math.imul(k,ot)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,n=n+Math.imul(A,lt)|0,i=(i=i+Math.imul(A,ut)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ut)|0,n=n+Math.imul(x,ft)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(_,ft)|0,a=a+Math.imul(_,ht)|0;var Et=(u+(n=n+Math.imul(m,pt)|0)|0)+((8191&(i=(i=i+Math.imul(m,gt)|0)+Math.imul(y,pt)|0))<<13)|0;u=((a=a+Math.imul(y,gt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,$))+Math.imul(j,Q)|0,a=Math.imul(j,$),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(N,K)|0,a=a+Math.imul(N,tt)|0,n=n+Math.imul(R,rt)|0,i=(i=i+Math.imul(R,nt)|0)+Math.imul(P,rt)|0,a=a+Math.imul(P,nt)|0,n=n+Math.imul(S,at)|0,i=(i=i+Math.imul(S,ot)|0)+Math.imul(C,at)|0,a=a+Math.imul(C,ot)|0,n=n+Math.imul(k,lt)|0,i=(i=i+Math.imul(k,ut)|0)+Math.imul(E,lt)|0,a=a+Math.imul(E,ut)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(M,ft)|0,a=a+Math.imul(M,ht)|0;var Lt=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((a=a+Math.imul(_,gt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(F,K),i=(i=Math.imul(F,tt))+Math.imul(j,K)|0,a=Math.imul(j,tt),n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(N,rt)|0,a=a+Math.imul(N,nt)|0,n=n+Math.imul(R,at)|0,i=(i=i+Math.imul(R,ot)|0)+Math.imul(P,at)|0,a=a+Math.imul(P,ot)|0,n=n+Math.imul(S,lt)|0,i=(i=i+Math.imul(S,ut)|0)+Math.imul(C,lt)|0,a=a+Math.imul(C,ut)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(E,ft)|0,a=a+Math.imul(E,ht)|0;var St=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((a=a+Math.imul(M,gt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(j,rt)|0,a=Math.imul(j,nt),n=n+Math.imul(I,at)|0,i=(i=i+Math.imul(I,ot)|0)+Math.imul(N,at)|0,a=a+Math.imul(N,ot)|0,n=n+Math.imul(R,lt)|0,i=(i=i+Math.imul(R,ut)|0)+Math.imul(P,lt)|0,a=a+Math.imul(P,ut)|0,n=n+Math.imul(S,ft)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(C,ft)|0,a=a+Math.imul(C,ht)|0;var Ct=(u+(n=n+Math.imul(k,pt)|0)|0)+((8191&(i=(i=i+Math.imul(k,gt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((a=a+Math.imul(E,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,at),i=(i=Math.imul(F,ot))+Math.imul(j,at)|0,a=Math.imul(j,ot),n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ut)|0)+Math.imul(N,lt)|0,a=a+Math.imul(N,ut)|0,n=n+Math.imul(R,ft)|0,i=(i=i+Math.imul(R,ht)|0)+Math.imul(P,ft)|0,a=a+Math.imul(P,ht)|0;var Ot=(u+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,gt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((a=a+Math.imul(C,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(F,lt),i=(i=Math.imul(F,ut))+Math.imul(j,lt)|0,a=Math.imul(j,ut),n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(N,ft)|0,a=a+Math.imul(N,ht)|0;var Rt=(u+(n=n+Math.imul(R,pt)|0)|0)+((8191&(i=(i=i+Math.imul(R,gt)|0)+Math.imul(P,pt)|0))<<13)|0;u=((a=a+Math.imul(P,gt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(F,ft),i=(i=Math.imul(F,ht))+Math.imul(j,ft)|0,a=Math.imul(j,ht);var Pt=(u+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(N,pt)|0))<<13)|0;u=((a=a+Math.imul(N,gt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var zt=(u+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,gt))+Math.imul(j,pt)|0))<<13)|0;return u=((a=Math.imul(j,gt))+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863,l[0]=vt,l[1]=mt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=At,l[8]=Mt,l[9]=Tt,l[10]=kt,l[11]=Et,l[12]=Lt,l[13]=St,l[14]=Ct,l[15]=Ot,l[16]=Rt,l[17]=Pt,l[18]=zt,0!==u&&(l[19]=u,r.length++),r};function p(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(d=h),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?h(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var f=0|this.words[u];this.words[u]=c<<26-a|f>>>a,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){(s=new a(null)).length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new a(1),s=new a(0),l=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(e.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(l),o.iushrn(1);for(var f=0,h=1;0==(r.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(i=0===e.cmpn(1)?o:s).cmpn(0)<0&&i.iadd(t),i},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new w(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function m(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}m.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},m.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},m.prototype.split=function(t,e){t.iushrn(this.n,0,e)},m.prototype.imulK=function(t){return t.imul(this.k)},i(y,m),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new b;else if("p192"===t)e=new x;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return v[t]=e,e},w.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},w.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,i),h=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var g=d,v=0;0!==g.cmp(s);v++)g=g.redSqr();n(v=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var f=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new A(t)},i(A,w),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof e||e,this)},{buffer:46}],38:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i=t.length,a=0;for(e=0;e>>1;if(!(c<=0)){var f,h=i.mallocDouble(2*c*s),d=i.mallocInt32(s);if((s=l(t,c,h,d))>0){if(1===c&&n)a.init(s),f=a.sweepComplete(c,r,0,s,h,d,0,s,h,d);else{var p=i.mallocDouble(2*c*u),g=i.mallocInt32(u);(u=l(e,c,p,g))>0&&(a.init(s+u),f=1===c?a.sweepBipartite(c,r,0,s,h,d,0,u,p,g):o(c,r,n,s,h,d,u,p,g),i.free(p),i.free(g))}i.free(h),i.free(d)}return f}}}function c(t,e){n.push([t,e])}},{"./lib/intersect":41,"./lib/sweep":45,"typedarray-pool":348}],40:[function(t,e,r){"use strict";var n="d",i="ax",a="vv",o="fp",s="es",l="rs",u="re",c="rb",f="ri",h="rp",d="bs",p="be",g="bb",v="bi",m="bp",y="rv",b="Q",x=[n,i,a,l,u,c,f,d,p,g,v];function _(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],_=x.slice();t||_.splice(3,0,o);var w=["function "+e+"("+_.join()+"){"];function A(e,o){var _=function(t,e,r){var o="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),_=["function ",o,"(",x.join(),"){","var ",s,"=2*",n,";"],w="for(var i="+l+","+h+"="+s+"*"+l+";i<"+u+";++i,"+h+"+="+s+"){var x0="+c+"["+i+"+"+h+"],x1="+c+"["+i+"+"+h+"+"+n+"],xi="+f+"[i];",A="for(var j="+d+","+m+"="+s+"*"+d+";j<"+p+";++j,"+m+"+="+s+"){var y0="+g+"["+i+"+"+m+"],"+(r?"y1="+g+"["+i+"+"+m+"+"+n+"],":"")+"yi="+v+"[j];";return t?_.push(w,b,":",A):_.push(A,b,":",w),r?_.push("if(y1"+p+"-"+d+"){"),t?(A(!0,!1),w.push("}else{"),A(!1,!1)):(w.push("if("+o+"){"),A(!0,!0),w.push("}else{"),A(!0,!1),w.push("}}else{if("+o+"){"),A(!1,!0),w.push("}else{"),A(!1,!1),w.push("}")),w.push("}}return "+e);var M=r.join("")+w.join("");return new Function(M)()}r.partial=_(!1),r.full=_(!0)},{}],41:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,c,E,L,S,C){!function(t,e){var r=8*i.log2(e+1)*(t+1)|0,a=i.nextPow2(x*r);w.length0;){var z=(R-=1)*x,I=w[z],N=w[z+1],D=w[z+2],F=w[z+3],j=w[z+4],B=w[z+5],U=R*_,V=A[U],H=A[U+1],q=1&B,G=!!(16&B),X=c,W=E,Y=S,Z=C;if(q&&(X=S,W=C,Y=c,Z=E),!(2&B&&(D=v(t,I,N,D,X,W,H),N>=D)||4&B&&(N=m(t,I,N,D,X,W,V))>=D)){var Q=D-N,$=j-F;if(G){if(t*Q*(Q+$)=p0)&&!(p1>=hi)",["p0","p1"]),g=c("lo===p0",["p0"]),v=c("lo>>1,h=2*t,d=f,p=s[h*f+e];for(;u=b?(d=y,p=b):m>=_?(d=v,p=m):(d=x,p=_):b>=_?(d=y,p=b):_>=m?(d=v,p=m):(d=x,p=_);for(var w=h*(c-1),A=h*d,M=0;Mr&&i[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p=0&&i.push("lo=e[k+n]");t.indexOf("hi")>=0&&i.push("hi=e[k+o]");return r.push(n.replace("_",i.join()).replace("$",t)),Function.apply(void 0,r)};var n="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],44:[function(t,e,r){"use strict";e.exports=function(t,e){e<=4*n?i(0,e-1,t):function t(e,r,f){var h=(r-e+1)/6|0,d=e+h,p=r-h,g=e+r>>1,v=g-h,m=g+h,y=d,b=v,x=g,_=m,w=p,A=e+1,M=r-1,T=0;u(y,b,f)&&(T=y,y=b,b=T);u(_,w,f)&&(T=_,_=w,w=T);u(y,x,f)&&(T=y,y=x,x=T);u(b,x,f)&&(T=b,b=x,x=T);u(y,_,f)&&(T=y,y=_,_=T);u(x,_,f)&&(T=x,x=_,_=T);u(b,w,f)&&(T=b,b=w,w=T);u(b,x,f)&&(T=b,b=x,x=T);u(_,w,f)&&(T=_,_=w,w=T);var k=f[2*b];var E=f[2*b+1];var L=f[2*_];var S=f[2*_+1];var C=2*y;var O=2*x;var R=2*w;var P=2*d;var z=2*g;var I=2*p;for(var N=0;N<2;++N){var D=f[C+N],F=f[O+N],j=f[R+N];f[P+N]=D,f[z+N]=F,f[I+N]=j}o(v,e,f);o(m,r,f);for(var B=A;B<=M;++B)if(c(B,k,E,f))B!==A&&a(B,A,f),++A;else if(!c(B,L,S,f))for(;;){if(c(M,L,S,f)){c(M,k,E,f)?(s(B,A,M,f),++A,--M):(a(B,M,f),--M);break}if(--Mt;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function c(t,e,r,n){var i=n[t*=2];return i>>1;a(d,E);for(var L=0,S=0,A=0;A=o)p(u,c,S--,C=C-o|0);else if(C>=0)p(s,l,L--,C);else if(C<=-o){C=-C-o|0;for(var O=0;O>>1;a(d,L);for(var S=0,C=0,O=0,M=0;M>1==d[2*M+3]>>1&&(P=2,M+=1),R<0){for(var z=-(R>>1)-1,I=0;I>1)-1;0===P?p(s,l,S--,z):1===P?p(u,c,C--,z):2===P&&p(f,h,O--,z)}}},scanBipartite:function(t,e,r,n,i,u,c,f,h,v,m,y){var b=0,x=2*t,_=e,w=e+t,A=1,M=1;n?M=o:A=o;for(var T=i;T>>1;a(d,S);for(var C=0,T=0;T=o?(R=!n,k-=o):(R=!!n,k-=1),R)g(s,l,C++,k);else{var P=y[k],z=x*k,I=m[z+e+1],N=m[z+e+1+t];t:for(var D=0;D>>1;a(d,A);for(var M=0,b=0;b=o)s[M++]=x-o;else{var k=p[x-=1],E=v*x,L=h[E+e+1],S=h[E+e+1+t];t:for(var C=0;C=0;--C)if(s[C]===x){for(var z=C+1;z0&&s.length>a){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else s=o[e]=r,++t._eventsCount;return t}function h(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var l=new Error('Unhandled "error" event. ('+e+")");throw l.context=e,l}if(!(r=o[t]))return!1;var u="function"==typeof r;switch(n=arguments.length){case 1:!function(t,e,r){if(e)t.call(r);else for(var n=t.length,i=v(t,n),a=0;a=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,a=o;break}if(a<0)return this;0===a?r.shift():function(t,e){for(var r=e,n=r+1,i=t.length;n=0;a--)this.removeListener(t,e[a]);return this},o.prototype.listeners=function(t){return p(this,t,!0)},o.prototype.rawListeners=function(t){return p(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},o.prototype.listenerCount=g,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],48:[function(t,e,r){"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var a=2147483647;function o(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return l(t,e,r)}function l(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=o(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return f(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(B(t,ArrayBuffer)||t&&B(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(i)return n?-1:D(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),U(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var a,o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}function u(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var c=-1;for(a=r;as&&(r=s-l),a=r;a>=0;a--){for(var f=!0,h=0;hi&&(n=i):n=i;var a=e.length;n>a/2&&(n=a/2);for(var o=0;o>8,i=r%256,a.push(i),a.push(n);return a}(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function M(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+f<=r)switch(f){case 1:u<128&&(c=u);break;case 2:128==(192&(a=t[i+1]))&&(l=(31&u)<<6|63&a)>127&&(c=l);break;case 3:a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&(l=(15&u)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return L(this,e,r);case"utf8":case"utf-8":return M(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return E(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,i){if(B(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(e>>>=0),l=Math.min(a,o),u=this.slice(n,i),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return y(this,t,e,r);case"ascii":return b(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,a){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(t,e,r,n,a){return e=+e,r>>>=0,a||R(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function z(t,e,r,n,a){return e=+e,r>>>=0,a||R(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*e)),a},s.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||C(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return P(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return P(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return z(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return z(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function B(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function U(t){return t!=t}},{"base64-js":18,ieee754:253}],49:[function(t,e,r){"use strict";var n=t("./lib/monotone"),i=t("./lib/triangulation"),a=t("./lib/delaunay"),o=t("./lib/filter");function s(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function l(t,e){return t[0]-e[0]||t[1]-e[1]}function u(t,e,r){return e in t?t[e]:r}e.exports=function(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var c=!!u(r,"delaunay",!0),f=!!u(r,"interior",!0),h=!!u(r,"exterior",!0),d=!!u(r,"infinity",!1);if(!f&&!h||0===t.length)return[];var p=n(t,e);if(c||f!==h||d){for(var g=i(t.length,function(t){return t.map(s).sort(l)}(e)),v=0;v0;){for(var c=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],p=1;p=0||(e.flip(s,c),i(t,e,r,f,s,h),i(t,e,r,s,h,f),i(t,e,r,h,c,f),i(t,e,r,c,f,h)))}}},{"binary-search-bounds":54,"robust-in-sphere":320}],51:[function(t,e,r){"use strict";var n,i=t("binary-search-bounds");function a(t,e,r,n,i,a,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=a,this.boundary=o}function o(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}e.exports=function(t,e,r){var n=function(t,e){for(var r=t.cells(),n=r.length,i=0;i0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;c[d];for(var p=0;p<3;++p){var g=h[3*d+p];g>=0&&0===u[g]&&(f[3*d+p]?l.push(g):(s.push(g),u[g]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var m=function(t,e,r){for(var n=0,i=0;i1&&i(r[h[d-2]],r[h[d-1]],a)>0;)t.push([h[d-1],h[d-2],o]),d-=1;h.length=d,h.push(o);var p=c.upperIds;for(d=p.length;d>1&&i(r[p[d-2]],r[p[d-1]],a)<0;)t.push([p[d-2],p[d-1],o]),d-=1;p.length=d,p.push(o)}}function d(t,e){var r;return(r=t.a[0]m[0]&&i.push(new u(m,v,s,f),new u(v,m,o,f))}i.sort(c);for(var y=i[0].a[0]-(1+Math.abs(i[0].a[0]))*Math.pow(2,-52),b=[new l([y,1],[y,0],-1,[],[],[],[])],x=[],f=0,_=i.length;f<_;++f){var w=i[f],A=w.type;A===a?h(x,b,t,w.a,w.idx):A===s?p(b,t,w):g(b,t,w)}return x}},{"binary-search-bounds":54,"robust-orientation":322}],53:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function i(t,e){this.stars=t,this.edges=e}e.exports=function(t,e){for(var r=new Array(t),n=0;n=0}}(),a.removeTriangle=function(t,e,r){var n=this.stars;o(n[t],e,r),o(n[e],r,t),o(n[r],t,e)},a.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},a.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;n>>1,x=a[m]"];return i?e.indexOf("c")<0?a.push(";if(x===y){return m}else if(x<=y){"):a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):a.push(";if(",e,"){i=m;"),r?a.push("l=m+1}else{h=m-1}"):a.push("h=m-1}else{l=m+1}"),a.push("}"),i?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],55:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1,r=1;rr?r:t:te?e:t}},{}],59:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;ae[2]?1:0)}function m(t,e,r){if(0!==t.length){if(e)for(var n=0;n=0;--a){var b=e[c=(E=n[a])[0]],x=b[0],_=b[1],w=t[x],A=t[_];if((w[0]-A[0]||w[1]-A[1])<0){var M=x;x=_,_=M}b[0]=x;var T,k=b[1]=E[1];for(i&&(T=b[2]);a>0&&n[a-1][0]===c;){var E,L=(E=n[--a])[1];i?e.push([k,L,T]):e.push([k,L]),k=L}i?e.push([k,_,T]):e.push([k,_])}return h}(t,e,h,v,r));return m(e,y,r),!!y||(h.length>0||v.length>0)}},{"./lib/rat-seg-intersect":60,"big-rat":22,"big-rat/cmp":20,"big-rat/to-float":34,"box-intersect":39,nextafter:287,"rat-vec":311,"robust-segment-intersect":325,"union-find":349}],60:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=s(e,t),f=s(n,r),h=c(a,f);if(0===o(h))return null;var d=s(t,r),p=c(f,d),g=i(p,h),v=u(a,g);return l(t,v)};var n=t("big-rat/mul"),i=t("big-rat/div"),a=t("big-rat/sub"),o=t("big-rat/sign"),s=t("rat-vec/sub"),l=t("rat-vec/add"),u=t("rat-vec/muls");function c(t,e){return a(n(t[0],e[1]),n(t[1],e[0]))}},{"big-rat/div":21,"big-rat/mul":31,"big-rat/sign":32,"big-rat/sub":33,"rat-vec/add":310,"rat-vec/muls":312,"rat-vec/sub":313}],61:[function(t,e,r){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],62:[function(t,e,r){"use strict";var n=t("color-rgba"),i=t("clamp"),a=t("dtype");e.exports=function(t,e){"float"!==e&&e||(e="array"),"uint"===e&&(e="uint8"),"uint_clamped"===e&&(e="uint8_clamped");var r=new(a(e))(4),o="uint8"!==e&&"uint8_clamped"!==e;return t.length&&"string"!=typeof t||((t=n(t))[0]/=255,t[1]/=255,t[2]/=255),function(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||!!(Array.isArray(t)&&(t[0]>1||0===t[0])&&(t[1]>1||0===t[1])&&(t[2]>1||0===t[2])&&(!t[3]||t[3]>1))}(t)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=null!=t[3]?t[3]:255,o&&(r[0]/=255,r[1]/=255,r[2]/=255,r[3]/=255),r):(o?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=null!=t[3]?t[3]:1):(r[0]=i(Math.floor(255*t[0]),0,255),r[1]=i(Math.floor(255*t[1]),0,255),r[2]=i(Math.floor(255*t[2]),0,255),r[3]=null==t[3]?255:i(Math.floor(255*t[3]),0,255)),r)}},{clamp:58,"color-rgba":64,dtype:85}],63:[function(t,e,r){(function(r){"use strict";var n=t("color-name"),i=t("is-plain-obj"),a=t("defined");e.exports=function(t){var e,s,l=[],u=1;if("string"==typeof t)if(n[t])l=n[t].slice(),s="rgb";else if("transparent"===t)u=0,s="rgb",l=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var c=t.slice(1),f=c.length,h=f<=4;u=1,h?(l=[parseInt(c[0]+c[0],16),parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16)],4===f&&(u=parseInt(c[3]+c[3],16)/255)):(l=[parseInt(c[0]+c[1],16),parseInt(c[2]+c[3],16),parseInt(c[4]+c[5],16)],8===f&&(u=parseInt(c[6]+c[7],16)/255)),l[0]||(l[0]=0),l[1]||(l[1]=0),l[2]||(l[2]=0),s="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var d=e[1],c=d.replace(/a$/,"");s=c;var f="cmyk"===c?4:"gray"===c?1:3;l=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===f?parseFloat(t)/100:"rgb"===c?255*parseFloat(t)/100:parseFloat(t);if("h"===c[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),d===c&&l.push(1),u=void 0===l[f]?1:l[f],l=l.slice(0,f)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(l=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),s=t.match(/([a-z])/gi).join("").toLowerCase());else if(isNaN(t))if(i(t)){var p=a(t.r,t.red,t.R,null);null!==p?(s="rgb",l=[p,a(t.g,t.green,t.G),a(t.b,t.blue,t.B)]):(s="hsl",l=[a(t.h,t.hue,t.H),a(t.s,t.saturation,t.S),a(t.l,t.lightness,t.L,t.b,t.brightness)]),u=a(t.a,t.alpha,t.opacity,1),null!=t.opacity&&(u/=100)}else(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(l=[t[0],t[1],t[2]],s="rgb",u=4===t.length?t[3]:1);else s="rgb",l=[t>>>16,(65280&t)>>>8,255&t];return{space:s,values:l,alpha:u}};var o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":61,defined:82,"is-plain-obj":261}],64:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t){var e,r=n(t);return r.space?((e=Array(3))[0]=a(r.values[0],0,255),e[1]=a(r.values[1],0,255),e[2]=a(r.values[2],0,255),"h"===r.space[0]&&(e=i.rgb(e)),e.push(a(r.alpha,0,1)),e):[]}},{clamp:58,"color-parse":63,"color-space/hsl":65}],65:[function(t,e,r){"use strict";var n=t("./rgb");e.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,r,n,i,a,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[a=255*l,a,a];e=2*l-(r=l<.5?l*(1+s):l+s-l*s),i=[0,0,0];for(var u=0;u<3;u++)(n=o+1/3*-(u-1))<0?n++:n>1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n=t[0]/255,i=t[1]/255,a=t[2]/255,o=Math.min(n,i,a),s=Math.max(n,i,a),l=s-o;return s===o?e=0:n===s?e=(i-a)/l:i===s?e=2+(a-n)/l:a===s&&(e=4+(n-i)/l),(e=Math.min(60*e,360))<0&&(e+=360),r=(o+s)/2,[e,100*(s===o?0:r<=.5?l/(s+o):l/(2-s-o)),100*r]}},{"./rgb":66}],66:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],67:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:1,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],68:[function(t,e,r){"use strict";var n=t("./colorScale"),i=t("lerp");function a(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]]}function o(t){for(var e,r="#",n=0;n<3;++n)r+=("00"+(e=(e=t[n]).toString(16))).substr(e.length);return r}function s(t){return"rgba("+t.join(",")+")"}e.exports=function(t){var e,r,l,u,c,f,h,d,p,g;t||(t={});d=(t.nshades||72)-1,h=t.format||"hex",(f=t.colormap)||(f="jet");if("string"==typeof f){if(f=f.toLowerCase(),!n[f])throw Error(f+" not a supported colorscale");c=n[f]}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);c=f.slice()}if(c.length>d+1)throw new Error(f+" map requires nshades to be at least size "+c.length);p=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:t.alpha.slice():"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1];e=c.map(function(t){return Math.round(t.index*d)}),p[0]=Math.min(Math.max(p[0],0),1),p[1]=Math.min(Math.max(p[1],0),1);var v=c.map(function(t,e){var r=c[e].index,n=c[e].rgb.slice();return 4===n.length&&n[3]>=0&&n[3]<=1?n:(n[3]=p[0]+(p[1]-p[0])*r,n)}),m=[];for(g=0;g0?-1:l(t,e,a)?-1:1:0===s?u>0?1:l(t,e,r)?1:-1:i(u-s)}var h=n(t,e,r);if(h>0)return o>0&&n(t,e,a)>0?1:-1;if(h<0)return o>0||n(t,e,a)>0?1:-1;var d=n(t,e,a);return d>0?1:l(t,e,r)?1:-1};var n=t("robust-orientation"),i=t("signum"),a=t("two-sum"),o=t("robust-product"),s=t("robust-sum");function l(t,e,r){var n=a(t[0],-e[0]),i=a(t[1],-e[1]),l=a(r[0],-e[0]),u=a(r[1],-e[1]),c=s(o(n,l),o(i,u));return c[c.length-1]>=0}},{"robust-orientation":322,"robust-product":323,"robust-sum":327,signum:328,"two-sum":347}],70:[function(t,e,r){e.exports=function(t,e){var r=t.length,a=t.length-e.length;if(a)return a;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||n(t[0],t[1])-n(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(a=o+t[2]-(s+e[2]))return a;var l=n(t[0],t[1]),u=n(e[0],e[1]);return n(l,t[2])-n(u,e[2])||n(l+t[2],o)-n(u+e[2],s);case 4:var c=t[0],f=t[1],h=t[2],d=t[3],p=e[0],g=e[1],v=e[2],m=e[3];return c+f+h+d-(p+g+v+m)||n(c,f,h,d)-n(p,g,v,m,p)||n(c+f,c+h,c+d,f+h,f+d,h+d)-n(p+g,p+v,p+m,g+v,g+m,v+m)||n(c+f+h,c+f+d,c+h+d,f+h+d)-n(p+g+v,p+g+m,p+v+m,g+v+m);default:for(var y=t.slice().sort(i),b=e.slice().sort(i),x=0;xt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}},{}],74:[function(t,e,r){"use strict";e.exports=function(t){var e=n(t),r=e.length;if(r<=2)return[];for(var i=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}(o,r)}};var n=t("incremental-convex-hull"),i=t("affine-hull")},{"affine-hull":13,"incremental-convex-hull":254}],76:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,u=(1+2*i)*l,c=i*l,f=s*(3-2*i),h=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=u*t[d]+c*e[d]+f*r[d]+h*n[d];return a}return u*t+c*e+f*r+h*n},e.exports.derivative=function(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n}},{}],77:[function(t,e,r){"use strict";var n=t("./lib/thunk.js");function i(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}e.exports=function(t){var e=new i;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var a=0;a0)throw new Error("cwise: pre() block may not reference array args");if(a0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(a),e.shimArgs.push("scalar"+a);else if("index"===o){if(e.indexArgs.push(a),a0)throw new Error("cwise: pre() block may not reference array index");if(a0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(a),ar.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,n(e)}},{"./lib/thunk.js":79}],78:[function(t,e,r){"use strict";var n=t("uniq");function i(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n0&&l.push("var "+u.join(",")),n=a-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function a(t,e,r){for(var n=t.body,i=[],a=[],o=0;o0&&y.push("shape=SS.slice(0)"),t.indexArgs.length>0){var b=new Array(r);for(l=0;l0&&m.push("var "+y.join(",")),l=0;l3&&m.push(a(t.pre,t,s));var A=a(t.body,t,s),M=function(t){for(var e=0,r=t[0].length;e0,u=[],c=0;c0;){"].join("")),u.push(["if(j",c,"<",s,"){"].join("")),u.push(["s",e[c],"=j",c].join("")),u.push(["j",c,"=0"].join("")),u.push(["}else{s",e[c],"=",s].join("")),u.push(["j",c,"-=",s,"}"].join("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(c=0;c3&&m.push(a(t.post,t,s)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+m.join("\n")+"\n----------");var T=[t.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",M,function(t){for(var e=new Array(t.length),r=!0,n=0;n0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}(s)].join("");return new Function(["function ",T,"(",v.join(","),"){",m.join("\n"),"} return ",T].join(""))()}},{uniq:350}],79:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],i=t.funcName+"_cwise_thunk";e.push(["return function ",i,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],c=0;c0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[c]))),u.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}for(t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),c=0;ce?1:t>=e?0:NaN}function d(t){return null===t?NaN:+t}function p(t){return!isNaN(t)}function g(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}t.ascending=h,t.descending=function(t,e){return et?1:e>=t?0:NaN},t.min=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++in&&(r=n)}else{for(;++i=n){r=n;break}for(;++in&&(r=n)}return r},t.max=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++ir&&(r=n)}else{for(;++i=n){r=n;break}for(;++ir&&(r=n)}return r},t.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return o/(l-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var v=g(h);function m(t){return t.length}t.bisectLeft=v.left,t.bisect=t.bisectRight=v.right,t.bisector=function(t){return g(1===t.length?function(e,r){return h(t(e),r)}:t)},t.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},t.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},t.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function b(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function x(){this._=Object.create(null)}t.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=function(t){var e=1;for(;t*e%1;)e*=10;return e}(y(r)),o=-1;if(t*=a,e*=a,(r*=a)<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=i.length)return r?r.call(n,a):e?a.sort(e):a;for(var l,u,c,f,h=-1,d=a.length,p=i[s++],g=new x;++h=i.length)return e;var n=[],o=a[r++];return e.forEach(function(e,i){n.push({key:e,values:t(i,r)})}),o?n.sort(function(t,e){return o(t.key,e.key)}):n}(o(t.map,e,0),0)},n.key=function(t){return i.push(t),n},n.sortKeys=function(t){return a[i.length-1]=t,n},n.sortValues=function(t){return e=t,n},n.rollup=function(t){return r=t,n},n},t.set=function(t){var e=new C;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},t.event=null,t.requote=function(t){return t.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,V={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function H(t){return V(t,W),t}var q=function(t,e){return e.querySelector(t)},G=function(t,e){return e.querySelectorAll(t)},X=function(t,e){var r=t.matches||t[P(t,"matchesSelector")];return(X=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(q=function(t,e){return Sizzle(t,e)[0]||null},G=Sizzle,X=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var W=t.selection.prototype=[];function Y(t){return"function"==typeof t?t:function(){return q(t,this)}}function Z(t){return"function"==typeof t?t:function(){return G(t,this)}}W.select=function(t){var e,r,n,i,a=[];t=Y(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),$.hasOwnProperty(r)?{space:$[r],local:t}:t}},W.attr=function(e,r){if(arguments.length<2){if("string"==typeof e){var n=this.node();return(e=t.ns.qualify(e)).local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(r in e)this.each(J(r,e[r]));return this}return this.each(J(e,r))},W.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=et(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},W.sort=function(t){t=function(t){arguments.length||(t=h);return function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.slice(0,o));var l=pt.get(e);function u(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=vt),o?r?function(){var t=s(r,n(arguments));u.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:u:r?I:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var i in this)if(r=i.match(n)){var a=this[i];this.removeEventListener(r[1],a,a.$),delete this[i]}}}t.selection.enter=ft,t.selection.enter.prototype=ht,ht.append=W.append,ht.empty=W.empty,ht.node=W.node,ht.call=W.call,ht.size=W.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s=n&&(n=e+1);!(o=s[n])&&++n0?1:t<0?-1:0}function Rt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Pt(t){return t>1?0:t<-1?Tt:Math.acos(t)}function zt(t){return t>1?Lt:t<-1?-Lt:Math.asin(t)}function It(t){return((t=Math.exp(t))+1/t)/2}function Nt(t){return(t=Math.sin(t/2))*t}var Dt=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],u=e[2],c=s-i,f=l-a,h=c*c+f*f;if(h0&&(e=e.transition().duration(g)),e.call(w.event)}function E(){u&&u.domain(l.range().map(function(t){return(t-h.x)/h.k}).map(l.invert)),f&&f.domain(c.range().map(function(t){return(t-h.y)/h.k}).map(c.invert))}function L(t){v++||t({type:"zoomstart"})}function S(t){E(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function C(t){--v||(t({type:"zoomend"}),r=null)}function O(){var e=this,r=_.of(e,arguments),n=0,i=t.select(o(e)).on(y,function(){n=1,T(t.mouse(e),a),S(r)}).on(b,function(){i.on(y,null).on(b,null),s(n),C(r)}),a=A(t.mouse(e)),s=bt(e);fs.call(e),L(r)}function R(){var e,r=this,n=_.of(r,arguments),i={},a=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,u="touchend"+o,c=[],f=t.select(r),d=bt(r);function p(){var n=t.touches(r);return e=h.k,n.forEach(function(t){t.identifier in i&&(i[t.identifier]=A(t))}),n}function g(){var e=t.event.target;t.select(e).on(l,v).on(u,y),c.push(e);for(var n=t.event.changedTouches,o=0,f=n.length;o1){m=d[0];var b=d[1],x=m[0]-b[0],_=m[1]-b[1];a=x*x+_*_}}function v(){var o,l,u,c,f=t.touches(r);fs.call(r);for(var h=0,d=f.length;h360?t-=360:t<0&&(t+=360),t<60?n+(i-n)*t/60:t<180?i:t<240?n+(i-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(i=r<=.5?r*(1+e):r+e-r*e),new ae(a(t+120),a(t),a(t-120))}function Gt(e,r,n){return this instanceof Gt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Gt?new Gt(e.h,e.c,e.l):ee(e instanceof Yt?e.l:(e=he((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Gt(e,r,n)}Ht.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Vt(this.h,this.s,this.l/t)},Ht.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Vt(this.h,this.s,t*this.l)},Ht.rgb=function(){return qt(this.h,this.s,this.l)},t.hcl=Gt;var Xt=Gt.prototype=new Ut;function Wt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Yt(r,Math.cos(t*=St)*e,Math.sin(t)*e)}function Yt(t,e,r){return this instanceof Yt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Yt?new Yt(t.l,t.a,t.b):t instanceof Gt?Wt(t.h,t.c,t.l):he((t=ae(t)).r,t.g,t.b):new Yt(t,e,r)}Xt.brighter=function(t){return new Gt(this.h,this.c,Math.min(100,this.l+Zt*(arguments.length?t:1)))},Xt.darker=function(t){return new Gt(this.h,this.c,Math.max(0,this.l-Zt*(arguments.length?t:1)))},Xt.rgb=function(){return Wt(this.h,this.c,this.l).rgb()},t.lab=Yt;var Zt=18,Qt=.95047,$t=1,Jt=1.08883,Kt=Yt.prototype=new Ut;function te(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ae(ie(3.2404542*(i=re(i)*Qt)-1.5371385*(n=re(n)*$t)-.4985314*(a=re(a)*Jt)),ie(-.969266*i+1.8760108*n+.041556*a),ie(.0556434*i-.2040259*n+1.0572252*a))}function ee(t,e,r){return t>0?new Gt(Math.atan2(r,e)*Ct,Math.sqrt(e*e+r*r),t):new Gt(NaN,NaN,t)}function re(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ne(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ie(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ae(t,e,r){return this instanceof ae?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ae?new ae(t.r,t.g,t.b):ce(""+t,ae,qt):new ae(t,e,r)}function oe(t){return new ae(t>>16,t>>8&255,255&t)}function se(t){return oe(t)+""}Kt.brighter=function(t){return new Yt(Math.min(100,this.l+Zt*(arguments.length?t:1)),this.a,this.b)},Kt.darker=function(t){return new Yt(Math.max(0,this.l-Zt*(arguments.length?t:1)),this.a,this.b)},Kt.rgb=function(){return te(this.l,this.a,this.b)},t.rgb=ae;var le=ae.prototype=new Ut;function ue(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function ce(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(pe(i[0]),pe(i[1]),pe(i[2]))}return(a=ge.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function fe(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e0&&l<1?0:n),new Vt(n,i,l)}function he(t,e,r){var n=ne((.4124564*(t=de(t))+.3575761*(e=de(e))+.1804375*(r=de(r)))/Qt),i=ne((.2126729*t+.7151522*e+.072175*r)/$t);return Yt(116*i-16,500*(n-i),200*(i-ne((.0193339*t+.119192*e+.9503041*r)/Jt)))}function de(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function pe(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}le.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,i=30;return e||r||n?(e&&e=200&&e<300||304===e){try{t=i.call(o,u)}catch(t){return void s.error.call(o,t)}s.load.call(o,t)}else s.error.call(o,u)}return!this.XDomainRequest||"withCredentials"in u||!/^(http(s)?:)?\/\//.test(e)||(u=new XDomainRequest),"onload"in u?u.onload=u.onerror=f:u.onreadystatechange=function(){u.readyState>3&&f()},u.onprogress=function(e){var r=t.event;t.event=e;try{s.progress.call(o,u)}finally{t.event=r}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?l[t]:(null==e?delete l[t]:l[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(r=null==t?null:t+"",o):r},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return i=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}}),o.send=function(t,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),u.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),u.setRequestHeader)for(var a in l)u.setRequestHeader(a,l[a]);return null!=r&&u.overrideMimeType&&u.overrideMimeType(r),null!=c&&(u.responseType=c),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),s.beforesend.call(o,u),u.send(null==n?null:n),o},o.abort=function(){return u.abort(),o},t.rebind(o,s,"on"),null==a?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(a))}ge.forEach(function(t,e){ge.set(t,oe(e))}),t.functor=ve,t.xhr=me(O),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function i(t,r,n){arguments.length<3&&(n=r,r=null);var i=ye(t,e,null==r?a:o(r),n);return i.row=function(t){return arguments.length?i.response(null==(r=t)?a:o(t)):r},i}function a(t){return i.parse(t.responseText)}function o(t){return function(e){return i.parse(e.responseText,t)}}function s(e){return e.map(l).join(t)}function l(t){return r.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return i.parse=function(t,e){var r;return i.parseRows(t,function(t,n){if(r)return r(t,n-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");r=e?function(t,r){return e(i(t),r)}:i})},i.parseRows=function(t,e){var r,i,a={},o={},s=[],l=t.length,u=0,c=0;function f(){if(u>=l)return o;if(i)return i=!1,a;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(we),we=setTimeout(Te,e)),_e=0):(_e=1,Ae(Te))}function ke(){for(var t=Date.now(),e=be;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ee(){for(var t,e=be,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}});t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Le(e,r))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Se[8+n/3]};var Ce=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Oe=t.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(e,r){return(e=t.round(e,Le(e,r))).toFixed(Math.max(0,Math.min(20,Le(e*(1+1e-15),r))))}});function Re(t){return t+""}var Pe=t.time={},ze=Date;function Ie(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Ie.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Ne.setUTCDate.apply(this._,arguments)},setDay:function(){Ne.setUTCDay.apply(this._,arguments)},setFullYear:function(){Ne.setUTCFullYear.apply(this._,arguments)},setHours:function(){Ne.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Ne.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Ne.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Ne.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Ne.setUTCSeconds.apply(this._,arguments)},setTime:function(){Ne.setTime.apply(this._,arguments)}};var Ne=Date.prototype;function De(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o68?1900:2e3),r+i[0].length):-1}function Qe(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function $e(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Je(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Ke(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){Be.lastIndex=0;var n=Be.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ir(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,i=y(e)%60;return r+Ve(n,"0",2)+Ve(i,"0",2)}function ar(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function or(t){for(var e=t.length,r=-1;++r0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=i[o=(o+1)%i.length];return a.reverse().join(n)}:O;return function(e){var n=Ce.exec(e),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",u=n[4]||"",c=n[5],f=+n[6],h=n[7],d=n[8],p=n[9],g=1,v="",m="",y=!1,b=!0;switch(d&&(d=+d.substring(1)),(c||"0"===i&&"="===s)&&(c=i="0",s="="),p){case"n":h=!0,p="g";break;case"%":g=100,m="%",p="f";break;case"p":g=100,m="%",p="r";break;case"b":case"o":case"x":case"X":"#"===u&&(v="0"+p.toLowerCase());case"c":b=!1;case"d":y=!0,d=0;break;case"s":g=-1,p="r"}"$"===u&&(v=a[0],m=a[1]),"r"!=p||d||(p="g"),null!=d&&("g"==p?d=Math.max(1,Math.min(21,d)):"e"!=p&&"f"!=p||(d=Math.max(0,Math.min(20,d)))),p=Oe.get(p)||Re;var x=c&&h;return function(e){var n=m;if(y&&e%1)return"";var a=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(g<0){var u=t.formatPrefix(e,d);e=u.scale(e),n=u.symbol+m}else e*=g;var _,w,A=(e=p(e,d)).lastIndexOf(".");if(A<0){var M=b?e.lastIndexOf("e"):-1;M<0?(_=e,w=""):(_=e.substring(0,M),w=e.substring(M))}else _=e.substring(0,A),w=r+e.substring(A+1);!c&&h&&(_=o(_,1/0));var T=v.length+_.length+w.length+(x?0:a.length),k=T"===s?k+a+e:"^"===s?k.substring(0,T>>=1)+a+e+k.substring(T):a+(x?e:k+e))+n}}}(e),timeFormat:function(e){var r=e.dateTime,n=e.date,i=e.time,a=e.periods,o=e.days,s=e.shortDays,l=e.months,u=e.shortMonths;function c(t){var e=t.length;function r(r){for(var n,i,a,o=[],s=-1,l=0;++s=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=w[o in je?e.charAt(s++):o])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}c.utc=function(t){var e=c(t);function r(t){try{var r=new(ze=Ie);return r._=t,e(r)}finally{ze=Date}}return r.parse=function(t){try{ze=Ie;var r=e.parse(t);return r&&r._}finally{ze=Date}},r.toString=e.toString,r},c.multi=c.utc.multi=or;var h=t.map(),d=He(o),p=qe(o),g=He(s),v=qe(s),m=He(l),y=qe(l),b=He(u),x=qe(u);a.forEach(function(t,e){h.set(t.toLowerCase(),e)});var _={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:c(r),d:function(t,e){return Ve(t.getDate(),e,2)},e:function(t,e){return Ve(t.getDate(),e,2)},H:function(t,e){return Ve(t.getHours(),e,2)},I:function(t,e){return Ve(t.getHours()%12||12,e,2)},j:function(t,e){return Ve(1+Pe.dayOfYear(t),e,3)},L:function(t,e){return Ve(t.getMilliseconds(),e,3)},m:function(t,e){return Ve(t.getMonth()+1,e,2)},M:function(t,e){return Ve(t.getMinutes(),e,2)},p:function(t){return a[+(t.getHours()>=12)]},S:function(t,e){return Ve(t.getSeconds(),e,2)},U:function(t,e){return Ve(Pe.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ve(Pe.mondayOfYear(t),e,2)},x:c(n),X:c(i),y:function(t,e){return Ve(t.getFullYear()%100,e,2)},Y:function(t,e){return Ve(t.getFullYear()%1e4,e,4)},Z:ir,"%":function(){return"%"}},w={a:function(t,e,r){g.lastIndex=0;var n=g.exec(e.slice(r));return n?(t.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){d.lastIndex=0;var n=d.exec(e.slice(r));return n?(t.w=p.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){b.lastIndex=0;var n=b.exec(e.slice(r));return n?(t.m=x.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){m.lastIndex=0;var n=m.exec(e.slice(r));return n?(t.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,r){return f(t,_.c.toString(),e,r)},d:Je,e:Je,H:tr,I:tr,j:Ke,L:nr,m:$e,M:er,p:function(t,e,r){var n=h.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:rr,U:Xe,w:Ge,W:We,x:function(t,e,r){return f(t,_.x.toString(),e,r)},X:function(t,e,r){return f(t,_.X.toString(),e,r)},y:Ze,Y:Ye,Z:Qe,"%":ar};return c}(e)}};var sr=t.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function lr(){}t.format=sr.numberFormat,t.geo={},lr.prototype={s:0,t:0,add:function(t){cr(t,this.t,ur),cr(ur.s,this.s,this),this.s?this.t+=ur.t:this.s=ur.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ur=new lr;function cr(t,e,r){var n=r.s=t+e,i=n-t,a=n-i;r.t=t-a+(e-i)}function fr(t,e){t&&dr.hasOwnProperty(t.type)&&dr[t.type](t,e)}t.geo.stream=function(t,e){t&&hr.hasOwnProperty(t.type)?hr[t.type](t,e):fr(t,e)};var hr={Feature:function(t,e){fr(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n=0?1:-1,s=o*a,l=Math.cos(e),u=Math.sin(e),c=i*u,f=n*l+c*Math.cos(s),h=c*o*Math.sin(s);Lr.add(Math.atan2(h,f)),r=t,n=l,i=u}Sr.point=function(o,s){Sr.point=a,r=(t=o)*St,n=Math.cos(s=(e=s)*St/2+Tt/4),i=Math.sin(s)},Sr.lineEnd=function(){a(t,e)}}function Or(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function Rr(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Pr(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function zr(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Ir(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Nr(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Dr(t){return[Math.atan2(t[1],t[0]),zt(t[2])]}function Fr(t,e){return y(t[0]-e[0])At?i=90:u<-At&&(r=-90),f[0]=e,f[1]=n}};function d(t,a){c.push(f=[e=t,n=t]),ai&&(i=a)}function p(t,o){var s=Or([t*St,o*St]);if(l){var u=Pr(l,s),c=Pr([u[1],-u[0],0],u);Nr(c),c=Dr(c);var f=t-a,h=f>0?1:-1,p=c[0]*Ct*h,g=y(f)>180;if(g^(h*ai&&(i=v);else if(g^(h*a<(p=(p+360)%360-180)&&pi&&(i=o);g?t_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>a?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else d(t,o);l=s,a=t}function g(){h.point=p}function v(){f[0]=e,f[1]=n,h.point=d,l=null}function m(t,e){if(l){var r=t-a;u+=y(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Sr.point(t,e),p(t,e)}function b(){Sr.lineStart()}function x(){m(o,s),Sr.lineEnd(),y(u)>At&&(e=-(n=180)),f[0]=e,f[1]=n,l=null}function _(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function A(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_(g[0],g[1])&&(g[1]=d[1]),_(d[0],g[1])>_(g[0],g[1])&&(g[0]=d[0])):s.push(g=d);for(var l,u,d,p=-1/0,g=(o=0,s[u=s.length-1]);o<=u;g=d,++o)d=s[o],(l=_(g[1],d[0]))>p&&(p=l,e=d[0],n=g[1])}return c=f=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,i]]}}(),t.geo.centroid=function(e){mr=yr=br=xr=_r=wr=Ar=Mr=Tr=kr=Er=0,t.geo.stream(e,jr);var r=Tr,n=kr,i=Er,a=r*r+n*n+i*i;return a=0;--s)i.point((f=c[s])[0],f[1]);else n(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,p=!p}while(!d.v);i.lineEnd()}}}function Yr(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,A=w*_,M=A>Tt,T=p*b;if(Lr.add(Math.atan2(T*w*Math.sin(A),g*x+T*Math.cos(A))),a+=M?_+w*kt:_,M^h>=r^m>=r){var k=Pr(Or(f),Or(t));Nr(k);var E=Pr(i,k);Nr(E);var L=(M^_>=0?-1:1)*zt(E[2]);(n>L||n===L&&(k[0]||k[1]))&&(o+=M^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-At||a0){for(b||(o.polygonStart(),b=!0),o.lineStart();++a1&&2&e&&r.push(r.pop().concat(r.shift())),s.push(r.filter($r))}return c}}function $r(t){return t.length>1}function Jr(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:I,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Kr(t,e){return((t=t.x)[0]<0?t[1]-Lt-At:Lt-t[1])-((e=e.x)[0]<0?e[1]-Lt-At:Lt-e[1])}var tn=Qr(Xr,function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Tt:-Tt,l=y(a-r);y(l-Tt)0?Lt:-Lt),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Tt&&(y(r-i)At?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}(r,n,a,o),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=a,n=o),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}},function(t,e,r,n){var i;if(null==t)i=r*Lt,n.point(-Tt,i),n.point(0,i),n.point(Tt,i),n.point(Tt,0),n.point(Tt,-i),n.point(0,-i),n.point(-Tt,-i),n.point(-Tt,0),n.point(-Tt,i);else if(y(t[0]-e[0])>At){var a=t[0]0)){if(a/=h,h<0){if(a0){if(a>f)return;a>c&&(c=a)}if(a=r-l,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a0)){if(a/=d,d<0){if(a0){if(a>f)return;a>c&&(c=a)}if(a=n-u,d||!(a<0)){if(a/=d,d<0){if(a>f)return;a>c&&(c=a)}else if(d>0){if(a0&&(i.a={x:l+c*h,y:u+c*d}),f<1&&(i.b={x:l+f*h,y:u+f*d}),i}}}}}}var rn=1e9;function nn(e,r,n,i){return function(l){var u,c,f,h,d,p,g,v,m,y,b,x=l,_=Jr(),w=en(e,r,n,i),A={point:k,lineStart:function(){A.point=E,c&&c.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){u&&(E(h,d),p&&m&&_.rejoin(),u.push(_.buffer()));A.point=k,m&&l.lineEnd()},polygonStart:function(){l=_,u=[],c=[],b=!0},polygonEnd:function(){l=x,u=t.merge(u);var r=function(t){for(var e=0,r=c.length,n=t[1],i=0;in&&Rt(u,a,t)>0&&++e:a[1]<=n&&Rt(u,a,t)<0&&--e,u=a;return 0!==e}([e,i]),n=b&&r,a=u.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),M(null,null,1,l),l.lineEnd()),a&&Wr(u,o,r,M,l),l.polygonEnd()),u=c=f=null}};function M(t,o,l,u){var c=0,f=0;if(null==t||(c=a(t,l))!==(f=a(o,l))||s(t,o)<0^l>0)do{u.point(0===c||3===c?e:n,c>1?i:r)}while((c=(c+l+4)%4)!==f);else u.point(o[0],o[1])}function T(t,a){return e<=t&&t<=n&&r<=a&&a<=i}function k(t,e){T(t,e)&&l.point(t,e)}function E(t,e){var r=T(t=Math.max(-rn,Math.min(rn,t)),e=Math.max(-rn,Math.min(rn,e)));if(c&&f.push([t,e]),y)h=t,d=e,p=r,y=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&m)l.point(t,e);else{var n={a:{x:g,y:v},b:{x:t,y:e}};w(n)?(m||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),b=!1):r&&(l.lineStart(),l.point(t,e),b=!1)}g=t,v=e,m=r}return A};function a(t,i){return y(t[0]-e)0?0:3:y(t[0]-n)0?2:1:y(t[1]-r)0?1:0:i>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}}function an(t){var e=0,r=Tt/3,n=Sn(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Tt/180,r=t[1]*Tt/180):[e/Tt*180,r/Tt*180]},i}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,i=1+r*(2*n-r),a=Math.sqrt(i)/n;function o(t,e){var r=Math.sqrt(i-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),a-r*Math.cos(t)]}return o.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/n,zt((i-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,i,a,o={stream:function(t){return i&&(i.valid=!1),(i=a(t)).valid=!0,i},extent:function(s){return arguments.length?(a=nn(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),o):[[t,e],[r,n]]}};return o.extent([[0,0],[960,500]])},(t.geo.conicEqualArea=function(){return an(on)}).raw=on,t.geo.albers=function(){return t.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},t.geo.albersUsa=function(){var e,r,n,i,a=t.geo.albers(),o=t.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=t.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};function u(t){var a=t[0],o=t[1];return e=null,r(a,o),e||(n(a,o),e)||i(a,o),e}return u.invert=function(t){var e=a.scale(),r=a.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},u.stream=function(t){var e=a.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},u.precision=function(t){return arguments.length?(a.precision(t),o.precision(t),s.precision(t),u):a.precision()},u.scale=function(t){return arguments.length?(a.scale(t),o.scale(.35*t),s.scale(t),u.translate(a.translate())):a.scale()},u.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),c=+t[0],f=+t[1];return r=a.translate(t).clipExtent([[c-.455*e,f-.238*e],[c+.455*e,f+.238*e]]).stream(l).point,n=o.translate([c-.307*e,f+.201*e]).clipExtent([[c-.425*e+At,f+.12*e+At],[c-.214*e-At,f+.234*e-At]]).stream(l).point,i=s.translate([c-.205*e,f+.212*e]).clipExtent([[c-.214*e+At,f+.166*e+At],[c-.115*e-At,f+.234*e-At]]).stream(l).point,u},u.scale(1070)};var sn,ln,un,cn,fn,hn,dn={point:I,lineStart:I,lineEnd:I,polygonStart:function(){ln=0,dn.lineStart=pn},polygonEnd:function(){dn.lineStart=dn.lineEnd=dn.point=I,sn+=y(ln/2)}};function pn(){var t,e,r,n;function i(t,e){ln+=n*t-r*e,r=t,n=e}dn.point=function(a,o){dn.point=i,t=r=a,e=n=o},dn.lineEnd=function(){i(t,e)}}var gn={point:function(t,e){tfn&&(fn=t);ehn&&(hn=e)},lineStart:I,lineEnd:I,polygonStart:I,polygonEnd:I};function vn(){var t=mn(4.5),e=[],r={point:n,lineStart:function(){r.point=i},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=mn(e),r},result:function(){if(e.length){var t=e.join("");return e=[],t}}};function n(r,n){e.push("M",r,",",n,t)}function i(t,n){e.push("M",t,",",n),r.point=a}function a(t,r){e.push("L",t,",",r)}function o(){r.point=n}function s(){e.push("Z")}return r}function mn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var yn,bn={point:xn,lineStart:_n,lineEnd:wn,polygonStart:function(){bn.lineStart=An},polygonEnd:function(){bn.point=xn,bn.lineStart=_n,bn.lineEnd=wn}};function xn(t,e){br+=t,xr+=e,++_r}function _n(){var t,e;function r(r,n){var i=r-t,a=n-e,o=Math.sqrt(i*i+a*a);wr+=o*(t+r)/2,Ar+=o*(e+n)/2,Mr+=o,xn(t=r,e=n)}bn.point=function(n,i){bn.point=r,xn(t=n,e=i)}}function wn(){bn.point=xn}function An(){var t,e,r,n;function i(t,e){var i=t-r,a=e-n,o=Math.sqrt(i*i+a*a);wr+=o*(r+t)/2,Ar+=o*(n+e)/2,Mr+=o,Tr+=(o=n*t-r*e)*(r+t),kr+=o*(n+e),Er+=3*o,xn(r=t,n=e)}bn.point=function(a,o){bn.point=i,xn(t=r=a,e=n=o)},bn.lineEnd=function(){i(t,e)}}function Mn(t){var e=4.5,r={point:n,lineStart:function(){r.point=i},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=t,r},result:I};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,kt)}function i(e,n){t.moveTo(e,n),r.point=a}function a(e,r){t.lineTo(e,r)}function o(){r.point=n}function s(){t.closePath()}return r}function Tn(t){var e=.5,r=Math.cos(30*St),n=16;function i(e){return(n?function(e){var r,i,o,s,l,u,c,f,h,d,p,g,v={point:m,lineStart:y,lineEnd:x,polygonStart:function(){e.polygonStart(),v.lineStart=_},polygonEnd:function(){e.polygonEnd(),v.lineStart=y}};function m(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){f=NaN,v.point=b,e.lineStart()}function b(r,i){var o=Or([r,i]),s=t(r,i);a(f,h,c,d,p,g,f=s[0],h=s[1],c=r,d=o[0],p=o[1],g=o[2],n,e),e.point(f,h)}function x(){v.point=m,e.lineEnd()}function _(){y(),v.point=w,v.lineEnd=A}function w(t,e){b(r=t,e),i=f,o=h,s=d,l=p,u=g,v.point=b}function A(){a(f,h,c,d,p,g,i,o,r,s,l,u,n,e),v.lineEnd=x,x()}return v}:function(e){return En(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})})(e)}function a(n,i,o,s,l,u,c,f,h,d,p,g,v,m){var b=c-n,x=f-i,_=b*b+x*x;if(_>4*e&&v--){var w=s+d,A=l+p,M=u+g,T=Math.sqrt(w*w+A*A+M*M),k=Math.asin(M/=T),E=y(y(M)-1)e||y((b*O+x*R)/_-.5)>.3||s*d+l*p+u*g0&&16,i):Math.sqrt(e)},i}function kn(t){this.stream=t}function En(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Ln(t){return Sn(function(){return t})()}function Sn(e){var r,n,i,a,o,s,l=Tn(function(t,e){return[(t=r(t,e))[0]*u+a,o-t[1]*u]}),u=150,c=480,f=250,h=0,d=0,p=0,g=0,v=0,m=tn,b=O,x=null,_=null;function w(t){return[(t=i(t[0]*St,t[1]*St))[0]*u+a,o-t[1]*u]}function A(t){return(t=i.invert((t[0]-a)/u,(o-t[1])/u))&&[t[0]*Ct,t[1]*Ct]}function M(){i=Gr(n=Pn(p,g,v),r);var t=r(h,d);return a=c-t[0]*u,o=f+t[1]*u,T()}function T(){return s&&(s.valid=!1,s=null),w}return w.stream=function(t){return s&&(s.valid=!1),(s=Cn(m(n,l(b(t))))).valid=!0,s},w.clipAngle=function(t){return arguments.length?(m=null==t?(x=t,tn):function(t){var e=Math.cos(t),r=e>0,n=y(e)>At;return Qr(i,function(t){var e,s,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=i(f,h),v=r?g?0:o(f,h):g?o(f+(f<0?Tt:-Tt),h):0;if(!e&&(u=l=g)&&t.lineStart(),g!==l&&(d=a(e,p),(Fr(e,d)||Fr(p,d))&&(p[0]+=At,p[1]+=At,g=i(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1]),t.lineEnd()),e=d;else if(n&&e&&r^g){var m;v&s||!(m=a(p,e,!0))||(c=0,r?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||e&&Fr(e,p)||t.point(p[0],p[1]),e=p,l=g,s=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(u&&l)<<1}}},Dn(t,6*St),r?[0,-t]:[-Tt,t-Tt]);function i(t,r){return Math.cos(t)*Math.cos(r)>e}function a(t,r,n){var i=[1,0,0],a=Pr(Or(t),Or(r)),o=Rr(a,a),s=a[0],l=o-s*s;if(!l)return!n&&t;var u=e*o/l,c=-e*s/l,f=Pr(i,a),h=Ir(i,u);zr(h,Ir(a,c));var d=f,p=Rr(h,d),g=Rr(d,d),v=p*p-g*(Rr(h,h)-1);if(!(v<0)){var m=Math.sqrt(v),b=Ir(d,(-p-m)/g);if(zr(b,h),b=Dr(b),!n)return b;var x,_=t[0],w=r[0],A=t[1],M=r[1];w<_&&(x=_,_=w,w=x);var T=w-_,k=y(T-Tt)0^b[1]<(y(b[0]-_)Tt^(_<=b[0]&&b[0]<=w)){var E=Ir(d,(-p+m)/g);return zr(E,h),[b,Dr(E)]}}}function o(e,n){var i=r?t:Tt-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}((x=+t)*St),T()):x},w.clipExtent=function(t){return arguments.length?(_=t,b=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):O,T()):_},w.scale=function(t){return arguments.length?(u=+t,M()):u},w.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],M()):[c,f]},w.center=function(t){return arguments.length?(h=t[0]%360*St,d=t[1]%360*St,M()):[h*Ct,d*Ct]},w.rotate=function(t){return arguments.length?(p=t[0]%360*St,g=t[1]%360*St,v=t.length>2?t[2]%360*St:0,M()):[p*Ct,g*Ct,v*Ct]},t.rebind(w,l,"precision"),function(){return r=e.apply(this,arguments),w.invert=r.invert&&A,M()}}function Cn(t){return En(t,function(e,r){t.point(e*St,r*St)})}function On(t,e){return[t,e]}function Rn(t,e){return[t>Tt?t-kt:t<-Tt?t+kt:t,e]}function Pn(t,e,r){return t?e||r?Gr(In(t),Nn(e,r)):In(t):e||r?Nn(e,r):Rn}function zn(t){return function(e,r){return[(e+=t)>Tt?e-kt:e<-Tt?e+kt:e,r]}}function In(t){var e=zn(t);return e.invert=zn(-t),e}function Nn(t,e){var r=Math.cos(t),n=Math.sin(t),i=Math.cos(e),a=Math.sin(e);function o(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*r+s*n;return[Math.atan2(l*i-c*a,s*r-u*n),zt(c*i+l*a)]}return o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*i-l*a;return[Math.atan2(l*i+u*a,s*r+c*n),zt(c*r-s*n)]},o}function Dn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Fn(r,i),a=Fn(r,a),(o>0?ia)&&(i+=o*kt)):(i=t+o*kt,a=t-.5*l);for(var u,c=i;o>0?c>a:c2?t[2]*St:0),e.invert=function(e){return(e=t.invert(e[0]*St,e[1]*St))[0]*=Ct,e[1]*=Ct,e},e},Rn.invert=On,t.geo.circle=function(){var t,e,r=[0,0],n=6;function i(){var t="function"==typeof r?r.apply(this,arguments):r,n=Pn(-t[0]*St,-t[1]*St,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Ct,t[1]*=Ct}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=Dn((t=+r)*St,n*St),i):t},i.precision=function(r){return arguments.length?(e=Dn(t*St,(n=+r)*St),i):n},i.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*St,i=t[1]*St,a=e[1]*St,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=u*c-l*f*s)*r),l*c+u*f*s)},t.geo.graticule=function(){var e,r,n,i,a,o,s,l,u,c,f,h,d=10,p=d,g=90,v=360,m=2.5;function b(){return{type:"MultiLineString",coordinates:x()}}function x(){return t.range(Math.ceil(i/g)*g,n,g).map(f).concat(t.range(Math.ceil(l/v)*v,s,v).map(h)).concat(t.range(Math.ceil(r/d)*d,e,d).filter(function(t){return y(t%g)>At}).map(u)).concat(t.range(Math.ceil(o/p)*p,a,p).filter(function(t){return y(t%v)>At}).map(c))}return b.lines=function(){return x().map(function(t){return{type:"LineString",coordinates:t}})},b.outline=function(){return{type:"Polygon",coordinates:[f(i).concat(h(s).slice(1),f(n).reverse().slice(1),h(l).reverse().slice(1))]}},b.extent=function(t){return arguments.length?b.majorExtent(t).minorExtent(t):b.minorExtent()},b.majorExtent=function(t){return arguments.length?(i=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],i>n&&(t=i,i=n,n=t),l>s&&(t=l,l=s,s=t),b.precision(m)):[[i,l],[n,s]]},b.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),o>a&&(t=o,o=a,a=t),b.precision(m)):[[r,o],[e,a]]},b.step=function(t){return arguments.length?b.majorStep(t).minorStep(t):b.minorStep()},b.majorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],b):[g,v]},b.minorStep=function(t){return arguments.length?(d=+t[0],p=+t[1],b):[d,p]},b.precision=function(t){return arguments.length?(m=+t,u=jn(o,a,90),c=Bn(r,e,m),f=jn(l,s,90),h=Bn(i,n,m),b):m},b.majorExtent([[-180,-90+At],[180,90-At]]).minorExtent([[-180,-80-At],[180,80+At]])},t.geo.greatArc=function(){var e,r,n=Un,i=Vn;function a(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}return a.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},a.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,a):n},a.target=function(t){return arguments.length?(i=t,r="function"==typeof t?null:t,a):i},a.precision=function(){return arguments.length?a:0},a},t.geo.interpolate=function(t,e){return r=t[0]*St,n=t[1]*St,i=e[0]*St,a=e[1]*St,o=Math.cos(n),s=Math.sin(n),l=Math.cos(a),u=Math.sin(a),c=o*Math.cos(r),f=o*Math.sin(r),h=l*Math.cos(i),d=l*Math.sin(i),p=2*Math.asin(Math.sqrt(Nt(a-n)+o*l*Nt(i-r))),g=1/Math.sin(p),(v=p?function(t){var e=Math.sin(t*=p)*g,r=Math.sin(p-t)*g,n=r*c+e*h,i=r*f+e*d,a=r*s+e*u;return[Math.atan2(i,n)*Ct,Math.atan2(a,Math.sqrt(n*n+i*i))*Ct]}:function(){return[r*Ct,n*Ct]}).distance=p,v;var r,n,i,a,o,s,l,u,c,f,h,d,p,g,v},t.geo.length=function(e){return yn=0,t.geo.stream(e,Hn),yn};var Hn={sphere:I,point:I,lineStart:function(){var t,e,r;function n(n,i){var a=Math.sin(i*=St),o=Math.cos(i),s=y((n*=St)-t),l=Math.cos(s);yn+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*a-e*o*l)*s),e*a+r*o*l),t=n,e=a,r=o}Hn.point=function(i,a){t=i*St,e=Math.sin(a*=St),r=Math.cos(a),Hn.point=n},Hn.lineEnd=function(){Hn.point=Hn.lineEnd=I}},lineEnd:I,polygonStart:I,polygonEnd:I};function qn(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),a=t(n*i);return[a*i*Math.sin(e),a*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),a=Math.sin(i),o=Math.cos(i);return[Math.atan2(t*a,n*o),Math.asin(n&&r*a/n)]},r}var Gn=qn(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(t.geo.azimuthalEqualArea=function(){return Ln(Gn)}).raw=Gn;var Xn=qn(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},O);function Wn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(Tt/4+t/2)},i=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),a=r*Math.pow(n(t),i)/i;if(!i)return Qn;function o(t,e){a>0?e<-Lt+At&&(e=-Lt+At):e>Lt-At&&(e=Lt-At);var r=a/Math.pow(n(e),i);return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}return o.invert=function(t,e){var r=a-e,n=Ot(i)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/i,2*Math.atan(Math.pow(a/n,1/i))-Lt]},o}function Yn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),i=r/n+t;if(y(n)1&&Rt(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ii(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Ln(Kn)}).raw=Kn,ti.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Lt]},(t.geo.transverseMercator=function(){var t=$n(ti),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):[(t=r())[0],t[1],t[2]-90]},r([0,0,90])}).raw=ti,t.geom={},t.geom.hull=function(t){var e=ei,r=ri;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=ve(e),a=ve(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)d.push(t[s[u[n]][2]]);for(n=+f;nAt)s=s.L;else{if(!((i=a-wi(s,o))>At)){n>-At?(e=s.P,r=s):i>-At?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=mi(t);if(fi.insert(e,l),e||r){if(e===r)return Ei(e),r=mi(e.site),fi.insert(l,r),l.edge=r.edge=Ci(e.site,l.site),ki(e),void ki(r);if(r){Ei(e),Ei(r);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=r.site,g=p.x-c,v=p.y-f,m=2*(h*v-d*g),y=h*h+d*d,b=g*g+v*v,x={x:(v*y-d*b)/m+c,y:(h*b-g*y)/m+f};Oi(r.edge,u,p,x),l.edge=Ci(u,t,null,x),r.edge=Ci(t,p,null,x),ki(e),ki(r)}else l.edge=Ci(e.site,l.site)}}function _i(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;var s=(r=o.site).x,l=r.y,u=l-e;if(!u)return s;var c=s-n,f=1/a-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-a/2)))/f+n:(n+s)/2}function wi(t,e){var r=t.N;if(r)return _i(r,e);var n=t.site;return n.y===e?n.x:1/0}function Ai(t){this.site=t,this.edges=[]}function Mi(t,e){return e.angle-t.angle}function Ti(){zi(this),this.x=this.y=this.arc=this.site=this.cy=null}function ki(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,a=r.site;if(n!==a){var o=i.x,s=i.y,l=n.x-o,u=n.y-s,c=a.x-o,f=2*(l*(v=a.y-s)-u*c);if(!(f>=-Mt)){var h=l*l+u*u,d=c*c+v*v,p=(v*h-u*d)/f,g=(l*d-c*h)/f,v=g+s,m=gi.pop()||new Ti;m.arc=t,m.site=i,m.x=p+o,m.y=v+Math.sqrt(p*p+g*g),m.cy=v,t.circle=m;for(var y=null,b=di._;b;)if(m.y=s)return;if(h>p){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(h>p){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(a){if(a.y=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.xAt||y(i-r)>At)&&(s.splice(o,0,new Ri((m=a.site,b=c,x=y(n-f)At?{x:f,y:y(e-f)At?{x:y(r-p)At?{x:h,y:y(e-h)At?{x:y(r-d)=r&&u.x<=i&&u.y>=n&&u.y<=o?[[r,o],[i,o],[i,n],[r,n]]:[]).point=t[s]}),e}function s(t){return t.map(function(t,e){return{x:Math.round(n(t,e)/At)*At,y:Math.round(i(t,e)/At)*At,i:e}})}return o.links=function(t){return Fi(s(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},o.triangles=function(t){var e=[];return Fi(s(t)).cells.forEach(function(r,n){for(var i,a,o,s,l=r.site,u=r.edges.sort(Mi),c=-1,f=u.length,h=u[f-1].edge,d=h.l===l?h.r:h.l;++ca&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:Gi(r,n)})),a=Yi.lastIndex;return ag&&(g=l.x),l.y>v&&(v=l.y),u.push(l.x),c.push(l.y);else for(f=0;fg&&(g=x),_>v&&(v=_),u.push(x),c.push(_)}var w=g-d,A=v-p;function M(t,e,r,n,i,a,o,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,u=t.y;if(null!=l)if(y(l-r)+y(u-n)<.01)T(t,e,r,n,i,a,o,s);else{var c=t.point;t.x=t.y=t.point=null,T(t,c,l,u,i,a,o,s),T(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else T(t,e,r,n,i,a,o,s)}function T(t,e,r,n,i,a,o,s){var l=.5*(i+o),u=.5*(a+s),c=r>=l,f=n>=u,h=f<<1|c;t.leaf=!1,c?i=l:o=l,f?a=u:s=u,M(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){M(k,t,+m(t,++f),+b(t,f),d,p,g,v)}}),e,r,n,i,a,o,s)}w>A?v=p+w:g=d+A;var k={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){M(k,t,+m(t,++f),+b(t,f),d,p,g,v)}};if(k.visit=function(t){!function t(e,r,n,i,a,o){if(!e(r,n,i,a,o)){var s=.5*(n+a),l=.5*(i+o),u=r.nodes;u[0]&&t(e,u[0],n,i,s,l),u[1]&&t(e,u[1],s,i,a,l),u[2]&&t(e,u[2],n,l,s,o),u[3]&&t(e,u[3],s,l,a,o)}}(t,k,d,p,g,v)},k.find=function(t){return function(t,e,r,n,i,a,o){var s,l=1/0;return function t(u,c,f,h,d){if(!(c>a||f>o||h=_)<<1|e>=x,A=w+4;w=0&&!(n=t.interpolators[i](e,r)););return n}function Qi(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function aa(t){return 1-Math.cos(t*Lt)}function oa(t){return Math.pow(2,10*(t-1))}function sa(t){return 1-Math.sqrt(1-t*t)}function la(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function ua(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function ca(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=ha(i),s=fa(i,a),l=ha(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,n):t,a=n>=0?t.slice(n+1):"in";return i=Ji.get(i)||$i,a=Ki.get(a)||O,e=a(i.apply(null,r.call(arguments,1))),function(t){return t<=0?0:t>=1?1:e(t)}},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,i=e.c,a=e.l,o=r.h-n,s=r.c-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.c:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Wt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,i=e.s,a=e.l,o=r.h-n,s=r.s-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.s:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return qt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,i=e.a,a=e.b,o=r.l-n,s=r.a-i,l=r.b-a;return function(t){return te(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=ua,t.transform=function(e){var r=i.createElementNS(t.ns.prefix.svg,"g");return(t.transform=function(t){if(null!=t){r.setAttribute("transform",t);var e=r.transform.baseVal.consolidate()}return new ca(e?e.matrix:da)})(e)},ca.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var da={a:1,b:0,c:0,d:1,e:0,f:0};function pa(t){return t.length?t.pop()+",":""}function ga(e,r){var n=[],i=[];return e=t.transform(e),r=t.transform(r),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push("translate(",null,",",null,")");n.push({i:i-4,x:Gi(t[0],e[0])},{i:i-2,x:Gi(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,i),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(pa(r)+"rotate(",null,")")-2,x:Gi(t,e)})):e&&r.push(pa(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(pa(r)+"skewX(",null,")")-2,x:Gi(t,e)}):e&&r.push(pa(r)+"skewX("+e+")")}(e.skew,r.skew,n,i),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(pa(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Gi(t[0],e[0])},{i:i-2,x:Gi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(pa(r)+"scale("+e+")")}(e.scale,r.scale,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r0?n=t:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:n=0})):t>0&&(l.start({type:"start",alpha:n=t}),e=Me(s.tick)),s):n},s.start=function(){var t,e,r,n=m.length,l=y.length,c=u[0],p=u[1];for(t=0;t=0;)r.push(i[n])}function Sa(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++o=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;r&&(a.value=0),a.children=u}else r&&(a.value=+r.call(n,a,a.depth)||0),delete a.children;return Sa(i,function(e){var n,i;t&&(n=e.children)&&n.sort(t),r&&(i=e.parent)&&(i.value+=e.value)}),s}return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(La(t,function(t){t.children&&(t.value=0)}),Sa(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},t.layout.partition=function(){var e=t.layout.hierarchy(),r=[1,1];function n(t,n){var i=e.call(this,t,n);return function t(e,r,n,i){var a=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,a&&(o=a.length)){var o,s,l,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;ri&&(n=r,i=e);return n}function Ha(t){return t.reduce(qa,0)}function qa(t,e){return t+e[1]}function Ga(t,e){return Xa(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Xa(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function Wa(e){return[t.min(e),t.max(e)]}function Ya(t,e){return t.value-e.value}function Za(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Qa(t,e){t._pack_next=e,e._pack_prev=t}function $a(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Ja(t){if((e=t.children)&&(l=e.length)){var e,r,n,i,a,o,s,l,u=1/0,c=-1/0,f=1/0,h=-1/0;if(e.forEach(Ka),(r=e[0]).x=-r.r,r.y=0,b(r),l>1&&((n=e[1]).x=n.r,n.y=0,b(n),l>2))for(eo(r,n,i=e[2]),b(i),Za(r,i),r._pack_prev=i,Za(i,n),n=r._pack_next,a=3;a0)for(o=-1;++o=f[0]&&l<=f[1]&&((s=u[t.bisect(h,l,1,p)-1]).y+=g,s.push(a[o]));return u}return a.value=function(t){return arguments.length?(r=t,a):r},a.range=function(t){return arguments.length?(n=ve(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Xa(e,t)}:ve(t),a):i},a.frequency=function(t){return arguments.length?(e=!!t,a):e},a},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(Ya),n=0,i=[1,1];function a(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,Sa(s,function(t){t.r=+c(t.value)}),Sa(s,Ja),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;Sa(s,function(t){t.r+=f}),Sa(s,Ja),Sa(s,function(t){t.r-=f})}return function t(e,r,n,i){var a=e.children;e.x=r+=i*e.x;e.y=n+=i*e.y;e.r*=i;if(a)for(var o=-1,s=a.length;++od.x&&(d=t),t.depth>p.depth&&(p=t)});var g=r(h,d)/2-h.x,v=n[0]/(d.x+r(d,h)/2+g),m=n[1]/(p.depth||1);La(c,function(t){t.x=(t.x+g)*v,t.y=t.depth*m})}return u}function o(t){var e=t.children,n=t.parent.children,i=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,i=t.children,a=i.length;for(;--a>=0;)(e=i[a]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;i?(t.z=i.z+r(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+r(t._,i._));t.parent.A=function(t,e,n){if(e){for(var i,a=t,o=t,s=e,l=a.parent.children[0],u=a.m,c=o.m,f=s.m,h=l.m;s=io(s),a=no(a),s&&a;)l=no(l),(o=io(o)).a=t,(i=s.z+f-a.z-u+r(s._,a._))>0&&(ao(oo(s,t,n),t,i),u+=i,c+=i),f+=s.m,u+=a.m,h+=l.m,c+=o.m;s&&!io(o)&&(o.t=s,o.m+=f-c),a&&!no(l)&&(l.t=a,l.m+=u-h,n=t)}return n}(t,i,t.parent.A||n[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=n[0],t.y=t.depth*n[1]}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t)?l:null,a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null==(n=t)?null:l,a):i?n:null},Ea(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=ro,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),u=l[0],c=0;Sa(u,function(e){var n=e.children;n&&n.length?(e.x=function(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}(n),e.y=function(e){return 1+t.max(e,function(t){return t.y})}(n)):(e.x=s?c+=r(e,s):0,e.y=0,s=e)});var f=function t(e){var r=e.children;return r&&r.length?t(r[0]):e}(u),h=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(u),d=f.x-r(f,h)/2,p=h.x+r(h,f)/2;return Sa(u,i?function(t){t.x=(t.x-u.x)*n[0],t.y=(u.y-t.y)*n[1]}:function(t){t.x=(t.x-d)/(p-d)*n[0],t.y=(1-(u.y?t.y/u.y:1))*n[1]}),l}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t),a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null!=(n=t),a):i?n:null},Ea(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=so,s=!1,l="squarify",u=.5*(1+Math.sqrt(5));function c(t,e){for(var r,n,i=-1,a=t.length;++i0;)s.push(r=u[i-1]),s.area+=r.area,"squarify"!==l||(n=d(s,g))<=h?(u.pop(),h=n):(s.area-=s.pop().area,p(s,g,a,!1),g=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(p(s,g,a,!0),s.length=s.area=0),e.forEach(f)}}function h(t){var e=t.children;if(e&&e.length){var r,n=o(t),i=e.slice(),a=[];for(c(i,n.dx*n.dy/t.value),a.area=0;r=i.pop();)a.push(r),a.area+=r.area,null!=r.z&&(p(a,r.z?n.dx:n.dy,n,!i.length),a.length=a.area=0);e.forEach(h)}}function d(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return e*=e,(n*=n)?Math.max(e*i*u/n,n/(e*a*u)):1/0}function p(t,e,r,i){var a,o=-1,s=t.length,l=r.x,u=r.y,c=e?n(t.area/e):0;if(e==r.dx){for((i||c>r.dy)&&(c=r.dy);++or.dx)&&(c=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=t.random.normal.apply(t,arguments);return function(){return Math.exp(e())}},bates:function(e){var r=t.random.irwinHall(e);return function(){return r()/e}},irwinHall:function(t){return function(){for(var e=0,r=0;r2?vo:fo,s=i?ma:va;return a=t(e,r,s,n),o=t(r,e,s,Zi),l}function l(t){return a(t)}l.invert=function(t){return o(t)};l.domain=function(t){return arguments.length?(e=t.map(Number),s()):e};l.range=function(t){return arguments.length?(r=t,s()):r};l.rangeRound=function(t){return l.range(t).interpolate(ua)};l.clamp=function(t){return arguments.length?(i=t,s()):i};l.interpolate=function(t){return arguments.length?(n=t,s()):n};l.ticks=function(t){return xo(e,t)};l.tickFormat=function(t,r){return _o(e,t,r)};l.nice=function(t){return yo(e,t),s()};l.copy=function(){return t(e,r,n,i)};return s()}([0,1],[0,1],Zi,!1)};var wo={s:1,g:1,p:1,r:1,e:1};function Ao(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,i,a){function o(t){return(i?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return i?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return r(o(t))}l.invert=function(t){return s(r.invert(t))};l.domain=function(t){return arguments.length?(i=t[0]>=0,r.domain((a=t.map(Number)).map(o)),l):a};l.base=function(t){return arguments.length?(n=+t,r.domain(a.map(o)),l):n};l.nice=function(){var t=ho(a.map(o),i?Math:To);return r.domain(t),a=t.map(s),l};l.ticks=function(){var t=uo(a),e=[],r=t[0],l=t[1],u=Math.floor(o(r)),c=Math.ceil(o(l)),f=n%1?2:n;if(isFinite(c-u)){if(i){for(;u0;h--)e.push(s(u)*h);for(u=0;e[u]l;c--);e=e.slice(u,c)}return e};l.tickFormat=function(e,r){if(!arguments.length)return Mo;arguments.length<2?r=Mo:"function"!=typeof r&&(r=t.format(r));var i=Math.max(1,n*e/l.ticks().length);return function(t){var e=t/s(Math.round(o(t)));return e*n0?i[t-1]:r[0],tf?0:1;if(u=Et)return l(u,d)+(s?l(s,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,A,M,T,k=0,E=0,L=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Ro?Math.sqrt(s*s+u*u):+n.apply(this,arguments),d||(E*=-1),u&&(E=zt(v/u*Math.sin(m))),s&&(k=zt(v/s*Math.sin(m)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(f-E),_=u*Math.sin(f-E);var S=Math.abs(f-c-2*E)<=Tt?0:1;if(E&&Fo(y,b,x,_)===d^S){var C=(c+f)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(s){w=s*Math.cos(f-k),A=s*Math.sin(f-k),M=s*Math.cos(c+k),T=s*Math.sin(c+k);var O=Math.abs(c-f+2*k)<=Tt?0:1;if(k&&Fo(w,A,M,T)===1-d^O){var R=(c+f)/2;w=s*Math.cos(R),A=s*Math.sin(R),M=T=null}}else w=A=0;if(h>At&&(p=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function jo(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,v=h-c,m=d-f,y=v*v+m*m,b=r-n,x=c*d-h*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*m-v*_)/y,A=(-x*v-m*_)/y,M=(x*m+v*_)/y,T=(-x*v+m*_)/y,k=w-p,E=A-g,L=M-p,S=T-g;return k*k+E*E>L*L+S*S&&(w=M,A=T),[[w-l,A-u],[w*r/b,A*r/b]]}function Bo(t){var e=ei,r=ri,n=Xr,i=Vo,a=i.key,o=.7;function s(a){var s,l=[],u=[],c=-1,f=a.length,h=ve(e),d=ve(r);function p(){l.push("M",i(t(u),o))}for(;++c1&&i.push("H",n[0]);return i.join("")},"step-before":qo,"step-after":Go,basis:Yo,"basis-open":function(t){if(t.length<4)return Vo(t);var e,r=[],n=-1,i=t.length,a=[0],o=[0];for(;++n<3;)e=t[n],a.push(e[0]),o.push(e[1]);r.push(Zo(Jo,a)+","+Zo(Jo,o)),--n;for(;++n9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));s=-1;for(;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}(t))}});function Vo(t){return t.length>1?t.join("L"):t+"Z"}function Ho(t){return t.join("L")+"Z"}function qo(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;uTt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=ve(t),a):r},a.source=function(e){return arguments.length?(t=ve(e),a):t},a.target=function(t){return arguments.length?(e=ve(t),a):e},a.startAngle=function(t){return arguments.length?(n=ve(t),a):n},a.endAngle=function(t){return arguments.length?(i=ve(t),a):i},a},t.svg.diagonal=function(){var t=Un,e=Vn,r=is;function n(n,i){var a=t.call(this,n,i),o=e.call(this,n,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return"M"+(l=l.map(r))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}return n.source=function(e){return arguments.length?(t=ve(e),n):t},n.target=function(t){return arguments.length?(e=ve(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},t.svg.diagonal.radial=function(){var e=t.svg.diagonal(),r=is,n=e.projection;return e.projection=function(t){return arguments.length?n(function(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-Lt;return[r*Math.cos(n),r*Math.sin(n)]}}(r=t)):r},e},t.svg.symbol=function(){var t=os,e=as;function r(r,n){return(ls.get(t.call(this,r,n))||ss)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=ve(e),r):t},r.size=function(t){return arguments.length?(e=ve(t),r):e},r};var ls=t.map({circle:ss,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*cs)),r=e*cs;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/us),r=e*us/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/us),r=e*us/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ls.keys();var us=Math.sqrt(3),cs=Math.tan(30*St);W.transition=function(t){for(var e,r,n=ps||++ms,i=xs(t),a=[],o=gs||{time:Date.now(),ease:ia,delay:0,duration:250},s=-1,l=this.length;++s0;)u[--h].call(t,o);if(a>=1)return f.event&&f.event.end.call(t,t.__data__,e),--c.count?delete c[n]:delete t[r],1}f||(a=i.time,o=Me(function(t){var e=f.delay;if(o.t=e+a,e<=t)return h(t-e);o.c=h},0,a),f=c[n]={tween:new x,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++c.count)}vs.call=W.call,vs.empty=W.empty,vs.node=W.node,vs.size=W.size,t.transition=function(e,r){return e&&e.transition?ps?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=vs,vs.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=Y(t);for(var s=-1,l=this.length;++srect,.s>rect").attr("width",s[1]-s[0])}function g(t){t.select(".extent").attr("y",l[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",l[1]-l[0])}function v(){var f,v,m=this,y=t.select(t.event.target),b=n.of(m,arguments),x=t.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&i,A=!/^(e|w)$/.test(_)&&a,M=y.classed("extent"),T=bt(m),k=t.mouse(m),E=t.select(o(m)).on("keydown.brush",function(){32==t.event.keyCode&&(M||(f=null,k[0]-=s[1],k[1]-=l[1],M=2),F())}).on("keyup.brush",function(){32==t.event.keyCode&&2==M&&(k[0]+=s[1],k[1]+=l[1],M=0,F())});if(t.event.changedTouches?E.on("touchmove.brush",C).on("touchend.brush",R):E.on("mousemove.brush",C).on("mouseup.brush",R),x.interrupt().selectAll("*").interrupt(),M)k[0]=s[0]-k[0],k[1]=l[0]-k[1];else if(_){var L=+/w$/.test(_),S=+/^n/.test(_);v=[s[1-L]-k[0],l[1-S]-k[1]],k[0]=s[L],k[1]=l[S]}else t.event.altKey&&(f=k.slice());function C(){var e=t.mouse(m),r=!1;v&&(e[0]+=v[0],e[1]+=v[1]),M||(t.event.altKey?(f||(f=[(s[0]+s[1])/2,(l[0]+l[1])/2]),k[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Ps(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Ps(+e+1);return e}}:t))},i.ticks=function(t,e){var r=uo(i.domain()),n=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Ps(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Rs(e.copy(),r,n)},mo(i,e)}function Ps(t){return new Date(t)}Ls.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Os:Cs,Os.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Os.toString=Cs.toString,Pe.second=De(function(t){return new ze(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),Pe.seconds=Pe.second.range,Pe.seconds.utc=Pe.second.utc.range,Pe.minute=De(function(t){return new ze(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),Pe.minutes=Pe.minute.range,Pe.minutes.utc=Pe.minute.utc.range,Pe.hour=De(function(t){var e=t.getTimezoneOffset()/60;return new ze(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),Pe.hours=Pe.hour.range,Pe.hours.utc=Pe.hour.utc.range,Pe.month=De(function(t){return(t=Pe.day(t)).setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),Pe.months=Pe.month.range,Pe.months.utc=Pe.month.utc.range;var zs=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Is=[[Pe.second,1],[Pe.second,5],[Pe.second,15],[Pe.second,30],[Pe.minute,1],[Pe.minute,5],[Pe.minute,15],[Pe.minute,30],[Pe.hour,1],[Pe.hour,3],[Pe.hour,6],[Pe.hour,12],[Pe.day,1],[Pe.day,2],[Pe.week,1],[Pe.month,1],[Pe.month,3],[Pe.year,1]],Ns=Ls.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Xr]]),Ds={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Ps)},floor:O,ceil:O};Is.year=Pe.year,Pe.scale=function(){return Rs(t.scale.linear(),Is,Ns)};var Fs=Is.map(function(t){return[t[0].utc,t[1]]}),js=Ss.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Xr]]);function Bs(t){return JSON.parse(t.responseText)}function Us(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}Fs.year=Pe.year.utc,Pe.scale.utc=function(){return Rs(t.scale.linear(),Fs,js)},t.text=me(function(t){return t.responseText}),t.json=function(t,e){return ye(t,"application/json",Bs,e)},t.html=function(t,e){return ye(t,"text/html",Us,e)},t.xml=me(function(t){return t.responseXML}),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],82:[function(t,e,r){e.exports=function(){for(var t=0;t=2)return!1;t[r]=n}return!0}):_.filter(function(t){for(var e=0;e<=s;++e){var r=m[t[e]];if(r<0)return!1;t[e]=r}return!0});if(1&s)for(var c=0;c<_.length;++c){var x=_[c],h=x[0];x[0]=x[1],x[1]=h}return _}},{"incremental-convex-hull":254,uniq:350}],84:[function(t,e,r){(function(t){var r=!1;if("undefined"!=typeof Float64Array){var n=new Float64Array(1),i=new Uint32Array(n.buffer);if(n[0]=1,r=!0,1072693248===i[1]){e.exports=function(t){return n[0]=t,[i[0],i[1]]},e.exports.pack=function(t,e){return i[0]=t,i[1]=e,n[0]},e.exports.lo=function(t){return n[0]=t,i[0]},e.exports.hi=function(t){return n[0]=t,i[1]}}else if(1072693248===i[0]){e.exports=function(t){return n[0]=t,[i[1],i[0]]},e.exports.pack=function(t,e){return i[1]=t,i[0]=e,n[0]},e.exports.lo=function(t){return n[0]=t,i[1]},e.exports.hi=function(t){return n[0]=t,i[0]}}else r=!1}if(!r){var a=new t(8);e.exports=function(t){return a.writeDoubleLE(t,0,!0),[a.readUInt32LE(0,!0),a.readUInt32LE(4,!0)]},e.exports.pack=function(t,e){return a.writeUInt32LE(t,0,!0),a.writeUInt32LE(e,4,!0),a.readDoubleLE(0,!0)},e.exports.lo=function(t){return a.writeDoubleLE(t,0,!0),a.readUInt32LE(0,!0)},e.exports.hi=function(t){return a.writeDoubleLE(t,0,!0),a.readUInt32LE(4,!0)}}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:48}],85:[function(t,e,r){e.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},{}],86:[function(t,e,r){"use strict";e.exports=function(t,e){switch("undefined"==typeof e&&(e=0),typeof t){case"number":if(t>0)return function(t,e){var r,n;for(r=new Array(t),n=0;n=r-1){h=l.length-1;var p=t-e[r-1];for(d=0;d=r-1)for(var c=s.length-1,f=(e[r-1],0);f=0;--r)if(t[--e])return!1;return!0},s.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--f)n.push(a(l[f-1],u[f-1],arguments[f])),i.push(0)}},s.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-6?1/s:0;this._time.push(t);for(var h=r;h>0;--h){var d=a(u[h-1],c[h-1],arguments[h]);n.push(d),i.push((d-n[o++])*f)}}},s.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(a(o[l-1],s[l-1],arguments[l])),n.push(0)}},s.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var n=this._state,i=this._velocity,o=n.length-this.dimension,s=this.bounds,l=s[0],u=s[1],c=t-e,f=c>1e-6?1/c:0;this._time.push(t);for(var h=r;h>0;--h){var d=arguments[h];n.push(a(l[h-1],u[h-1],n[o++]+d)),i.push(d*f)}}},s.idle=function(t){var e=this.lastT();if(!(t=0;--f)n.push(a(l[f],u[f],n[o]+c*i[o])),i.push(0),o+=1}}},{"binary-search-bounds":35,"cubic-hermite":76}],92:[function(t,e,r){"use strict";e.exports=function(t){return new u(t||p,null)};var n=0,i=1;function a(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function o(t){return new a(t._color,t.key,t.value,t.left,t.right,t._count)}function s(t,e){return new a(t,e.key,e.value,e.left,e.right,e._count)}function l(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function u(t,e){this._compare=t,this.root=e}var c=u.prototype;function f(t,e){this.tree=t,this._stack=e}Object.defineProperty(c,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(c,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(c,"length",{get:function(){return this.root?this.root._count:0}}),c.insert=function(t,e){for(var r=this._compare,o=this.root,c=[],f=[];o;){var h=r(t,o.key);c.push(o),f.push(h),o=h<=0?o.left:o.right}c.push(new a(n,t,e,null,null,1));for(var d=c.length-2;d>=0;--d){o=c[d];f[d]<=0?c[d]=new a(o._color,o.key,o.value,c[d+1],o.right,o._count+1):c[d]=new a(o._color,o.key,o.value,o.left,c[d+1],o._count+1)}for(d=c.length-1;d>1;--d){var p=c[d-1];o=c[d];if(p._color===i||o._color===i)break;var g=c[d-2];if(g.left===p)if(p.left===o){if(!(v=g.right)||v._color!==n){if(g._color=n,g.left=p.right,p._color=i,p.right=g,c[d-2]=p,c[d-1]=o,l(g),l(p),d>=3)(m=c[d-3]).left===g?m.left=p:m.right=p;break}p._color=i,g.right=s(i,v),g._color=n,d-=1}else{if(!(v=g.right)||v._color!==n){if(p.right=o.left,g._color=n,g.left=o.right,o._color=i,o.left=p,o.right=g,c[d-2]=o,c[d-1]=p,l(g),l(p),l(o),d>=3)(m=c[d-3]).left===g?m.left=o:m.right=o;break}p._color=i,g.right=s(i,v),g._color=n,d-=1}else if(p.right===o){if(!(v=g.left)||v._color!==n){if(g._color=n,g.right=p.left,p._color=i,p.left=g,c[d-2]=p,c[d-1]=o,l(g),l(p),d>=3)(m=c[d-3]).right===g?m.right=p:m.left=p;break}p._color=i,g.left=s(i,v),g._color=n,d-=1}else{var v;if(!(v=g.left)||v._color!==n){var m;if(p.left=o.right,g._color=n,g.right=o.left,o._color=i,o.right=p,o.left=g,c[d-2]=o,c[d-1]=p,l(g),l(p),l(o),d>=3)(m=c[d-3]).right===g?m.right=o:m.left=o;break}p._color=i,g.left=s(i,v),g._color=n,d-=1}}return c[0]._color=i,new u(r,c[0])},c.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return function t(e,r){var n;if(r.left&&(n=t(e,r.left)))return n;return(n=e(r.key,r.value))||(r.right?t(e,r.right):void 0)}(t,this.root);case 2:return function t(e,r,n,i){if(r(e,i.key)<=0){var a;if(i.left&&(a=t(e,r,n,i.left)))return a;if(a=n(i.key,i.value))return a}if(i.right)return t(e,r,n,i.right)}(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return function t(e,r,n,i,a){var o,s=n(e,a.key),l=n(r,a.key);if(s<=0){if(a.left&&(o=t(e,r,n,i,a.left)))return o;if(l>0&&(o=i(a.key,a.value)))return o}if(l>0&&a.right)return t(e,r,n,i,a.right)}(e,r,this._compare,t,this.root)}},Object.defineProperty(c,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(c,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),c.at=function(t){if(t<0)return new f(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new f(this,[])},c.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<=0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new f(this,n)},c.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new f(this,n)},c.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new f(this,n)},c.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>=0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new f(this,n)},c.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new f(this,n);r=i<=0?r.left:r.right}return new f(this,[])},c.remove=function(t){var e=this.find(t);return e?e.remove():this},c.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var h=f.prototype;function d(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function p(t,e){return te?1:0}Object.defineProperty(h,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(h,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),h.clone=function(){return new f(this.tree,this._stack.slice())},h.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new a(r._color,r.key,r.value,r.left,r.right,r._count);for(var c=t.length-2;c>=0;--c){(r=t[c]).left===t[c+1]?e[c]=new a(r._color,r.key,r.value,e[c+1],r.right,r._count):e[c]=new a(r._color,r.key,r.value,r.left,e[c+1],r._count)}if((r=e[e.length-1]).left&&r.right){var f=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var h=e[f-1];e.push(new a(r._color,h.key,h.value,r.left,r.right,r._count)),e[f-1].key=r.key,e[f-1].value=r.value;for(c=e.length-2;c>=f;--c)r=e[c],e[c]=new a(r._color,r.key,r.value,r.left,e[c+1],r._count);e[f-1].left=e[f]}if((r=e[e.length-1])._color===n){var p=e[e.length-2];p.left===r?p.left=null:p.right===r&&(p.right=null),e.pop();for(c=0;c=0;--c){if(e=t[c],0===c)return void(e._color=i);if((r=t[c-1]).left===e){if((a=r.right).right&&a.right._color===n)return u=(a=r.right=o(a)).right=o(a.right),r.right=a.left,a.left=r,a.right=u,a._color=r._color,e._color=i,r._color=i,u._color=i,l(r),l(a),c>1&&((f=t[c-2]).left===r?f.left=a:f.right=a),void(t[c-1]=a);if(a.left&&a.left._color===n)return u=(a=r.right=o(a)).left=o(a.left),r.right=u.left,a.left=u.right,u.left=r,u.right=a,u._color=r._color,r._color=i,a._color=i,e._color=i,l(r),l(a),l(u),c>1&&((f=t[c-2]).left===r?f.left=u:f.right=u),void(t[c-1]=u);if(a._color===i){if(r._color===n)return r._color=i,void(r.right=s(n,a));r.right=s(n,a);continue}a=o(a),r.right=a.left,a.left=r,a._color=r._color,r._color=n,l(r),l(a),c>1&&((f=t[c-2]).left===r?f.left=a:f.right=a),t[c-1]=a,t[c]=r,c+11&&((f=t[c-2]).right===r?f.right=a:f.left=a),void(t[c-1]=a);if(a.right&&a.right._color===n)return u=(a=r.left=o(a)).right=o(a.right),r.left=u.right,a.right=u.left,u.right=r,u.left=a,u._color=r._color,r._color=i,a._color=i,e._color=i,l(r),l(a),l(u),c>1&&((f=t[c-2]).right===r?f.right=u:f.left=u),void(t[c-1]=u);if(a._color===i){if(r._color===n)return r._color=i,void(r.left=s(n,a));r.left=s(n,a);continue}var f;a=o(a),r.left=a.right,a.right=r,a._color=r._color,r._color=n,l(r),l(a),c>1&&((f=t[c-2]).right===r?f.right=a:f.left=a),t[c-1]=a,t[c]=r,c+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(h,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(h,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),h.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(h,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),h.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),n=e[e.length-1];r[r.length-1]=new a(n._color,n.key,t,n.left,n.right,n._count);for(var i=e.length-2;i>=0;--i)(n=e[i]).left===e[i+1]?r[i]=new a(n._color,n.key,n.value,r[i+1],n.right,n._count):r[i]=new a(n._color,n.key,n.value,n.left,r[i+1],n._count);return new u(this.tree._compare,r[0])},h.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(h,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],93:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=607/128,a=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function o(t){if(t<0)return Number("0/0");for(var e=a[0],r=a.length-1;r>0;--r)e+=a[r]/(t+r);var n=t+i+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(o(e));e-=1;for(var r=n[0],i=1;i<9;i++)r+=n[i]/(e+i);var a=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(a,e+.5)*Math.exp(-a)*r},e.exports.log=o},{}],94:[function(t,e,r){e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width);"number"==typeof e.height&&(r.height=e.height);var n,i=e;try{var a=[t];0===t.indexOf("webgl")&&a.push("experimental-"+t);for(var o=0;o0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}var g=[0,0,0],v={model:l,view:l,projection:l,_ortho:!1};f.isOpaque=function(){return!0},f.isTransparent=function(){return!1},f.drawTransparent=function(t){};var m=[0,0,0],y=[0,0,0],b=[0,0,0];f.draw=function(t){t=t||v;for(var e=this.gl,r=t.model||l,n=t.view||l,i=t.projection||l,a=this.bounds,s=t._ortho||!1,c=o(r,n,i,a,s),f=c.cubeEdges,h=c.axis,x=n[12],_=n[13],w=n[14],A=n[15],M=(s?2:1)*this.pixelRatio*(i[3]*x+i[7]*_+i[11]*w+i[15]*A)/e.drawingBufferHeight,T=0;T<3;++T)this.lastCubeProps.cubeEdges[T]=f[T],this.lastCubeProps.axis[T]=h[T];var k=d;for(T=0;T<3;++T)p(d[T],T,this.bounds,f,h);e=this.gl;var E,L=g;for(T=0;T<3;++T)this.backgroundEnable[T]?L[T]=h[T]:L[T]=0;this._background.draw(r,n,i,a,L,this.backgroundColor),this._lines.bind(r,n,i,this);for(T=0;T<3;++T){var S=[0,0,0];h[T]>0?S[T]=a[1][T]:S[T]=a[0][T];for(var C=0;C<2;++C){var O=(T+1+C)%3,R=(T+1+(1^C))%3;this.gridEnable[O]&&this._lines.drawGrid(O,R,this.bounds,S,this.gridColor[O],this.gridWidth[O]*this.pixelRatio)}for(C=0;C<2;++C){O=(T+1+C)%3,R=(T+1+(1^C))%3;this.zeroEnable[R]&&Math.min(a[0][R],a[1][R])<=0&&Math.max(a[0][R],a[1][R])>=0&&this._lines.drawZero(O,R,this.bounds,S,this.zeroLineColor[R],this.zeroLineWidth[R]*this.pixelRatio)}}for(T=0;T<3;++T){this.lineEnable[T]&&this._lines.drawAxisLine(T,this.bounds,k[T].primalOffset,this.lineColor[T],this.lineWidth[T]*this.pixelRatio),this.lineMirror[T]&&this._lines.drawAxisLine(T,this.bounds,k[T].mirrorOffset,this.lineColor[T],this.lineWidth[T]*this.pixelRatio);var P=u(m,k[T].primalMinor),z=u(y,k[T].mirrorMinor),I=this.lineTickLength;for(C=0;C<3;++C){var N=M/r[5*C];P[C]*=I[C]*N,z[C]*=I[C]*N}this.lineTickEnable[T]&&this._lines.drawAxisTicks(T,k[T].primalOffset,P,this.lineTickColor[T],this.lineTickWidth[T]*this.pixelRatio),this.lineTickMirror[T]&&this._lines.drawAxisTicks(T,k[T].mirrorOffset,z,this.lineTickColor[T],this.lineTickWidth[T]*this.pixelRatio)}this._lines.unbind(),this._text.bind(r,n,i,this.pixelRatio);var D,F;function j(t){(F=[0,0,0])[t]=1}function B(t,e,r){var n=(t+1)%3,i=(t+2)%3,a=e[n],o=e[i],s=r[n],l=r[i];a>0&&l>0?j(n):a>0&&l<0?j(n):a<0&&l>0?j(n):a<0&&l<0?j(n):o>0&&s>0?j(i):o>0&&s<0?j(i):o<0&&s>0?j(i):o<0&&s<0&&j(i)}for(T=0;T<3;++T){var U=k[T].primalMinor,V=k[T].mirrorMinor,H=u(b,k[T].primalOffset);for(C=0;C<3;++C)this.lineTickEnable[T]&&(H[C]+=M*U[C]*Math.max(this.lineTickLength[C],0)/r[5*C]);var q=[0,0,0];if(q[T]=1,this.tickEnable[T]){-3600===this.tickAngle[T]?(this.tickAngle[T]=0,this.tickAlign[T]="auto"):this.tickAlign[T]=-1,D=1,"auto"===(E=[this.tickAlign[T],.5,D])[0]?E[0]=0:E[0]=parseInt(""+E[0]),F=[0,0,0],B(T,U,V);for(C=0;C<3;++C)H[C]+=M*U[C]*this.tickPad[C]/r[5*C];this._text.drawTicks(T,this.tickSize[T],this.tickAngle[T],H,this.tickColor[T],q,F,E)}if(this.labelEnable[T]){D=0,F=[0,0,0],this.labels[T].length>4&&(j(T),D=1),"auto"===(E=[this.labelAlign[T],.5,D])[0]?E[0]=0:E[0]=parseInt(""+E[0]);for(C=0;C<3;++C)H[C]+=M*U[C]*this.labelPad[C]/r[5*C];H[T]+=.5*(a[0][T]+a[1][T]),this._text.drawLabel(T,this.labelSize[T],this.labelAngle[T],H,this.labelColor[T],[0,0,0],F,E)}}this._text.unbind()},f.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":96,"./lib/cube.js":97,"./lib/lines.js":98,"./lib/text.js":100,"./lib/ticks.js":101}],96:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=[],s=0,l=0;l<3;++l)for(var u=(l+1)%3,c=(l+2)%3,f=[0,0,0],h=[0,0,0],d=-1;d<=1;d+=2){r.push(s,s+2,s+1,s+1,s+2,s+3),f[l]=d,h[l]=d;for(var p=-1;p<=1;p+=2){f[u]=p;for(var g=-1;g<=1;g+=2)f[c]=g,e.push(f[0],f[1],f[2],h[0],h[1],h[2]),s+=1}var v=u;u=c,c=v}var m=n(t,new Float32Array(e)),y=n(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=i(t,[{buffer:m,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:m,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=a(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new o(t,m,b,x)};var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders").bg;function o(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}var s=o.prototype;s.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),this.vao.unbind(),l.disable(l.POLYGON_OFFSET_FILL)}},s.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":99,"gl-buffer":103,"gl-vao":168}],97:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,d){i(s,e,t),i(s,r,s);for(var y=0,b=0;b<2;++b){c[2]=a[b][2];for(var x=0;x<2;++x){c[1]=a[x][1];for(var _=0;_<2;++_)c[0]=a[_][0],h(l[y],c,s),y+=1}}for(var w=-1,b=0;b<8;++b){for(var A=l[b][3],M=0;M<3;++M)u[b][M]=l[b][M]/A;d&&(u[b][2]*=-1),A<0&&(w<0?w=b:u[b][2]L&&(w|=1<L&&(w|=1<u[b][1]&&(N=b));for(var D=-1,b=0;b<3;++b){var F=N^1<u[j][0]&&(j=F)}}var B=g;B[0]=B[1]=B[2]=0,B[n.log2(D^N)]=N&D,B[n.log2(N^j)]=N&j;var U=7^j;U===w||U===I?(U=7^D,B[n.log2(j^U)]=U&j):B[n.log2(D^U)]=U&D;for(var V=v,H=w,T=0;T<3;++T)V[T]=H&1< HALF_PI) && (b <= ONE_AND_HALF_PI)) ?\n b - PI :\n b;\n}\n\nfloat look_horizontal_or_vertical(float a, float ratio) {\n // ratio controls the ratio between being horizontal to (vertical + horizontal)\n // if ratio is set to 0.5 then it is 50%, 50%.\n // when using a higher ratio e.g. 0.75 the result would\n // likely be more horizontal than vertical.\n\n float b = positive_angle(a);\n\n return\n (b < ( ratio) * HALF_PI) ? 0.0 :\n (b < (2.0 - ratio) * HALF_PI) ? -HALF_PI :\n (b < (2.0 + ratio) * HALF_PI) ? 0.0 :\n (b < (4.0 - ratio) * HALF_PI) ? HALF_PI :\n 0.0;\n}\n\nfloat roundTo(float a, float b) {\n return float(b * floor((a + 0.5 * b) / b));\n}\n\nfloat look_round_n_directions(float a, int n) {\n float b = positive_angle(a);\n float div = TWO_PI / float(n);\n float c = roundTo(b, div);\n return look_upwards(c);\n}\n\nfloat applyAlignOption(float rawAngle, float delta) {\n return\n (option > 2) ? look_round_n_directions(rawAngle + delta, option) : // option 3-n: round to n directions\n (option == 2) ? look_horizontal_or_vertical(rawAngle + delta, hv_ratio) : // horizontal or vertical\n (option == 1) ? rawAngle + delta : // use free angle, and flip to align with one direction of the axis\n (option == 0) ? look_upwards(rawAngle) : // use free angle, and stay upwards\n (option ==-1) ? 0.0 : // useful for backward compatibility, all texts remains horizontal\n rawAngle; // otherwise return back raw input angle\n}\n\nbool isAxisTitle = (axis.x == 0.0) &&\n (axis.y == 0.0) &&\n (axis.z == 0.0);\n\nvoid main() {\n //Compute world offset\n float axisDistance = position.z;\n vec3 dataPosition = axisDistance * axis + offset;\n\n float beta = angle; // i.e. user defined attributes for each tick\n\n float axisAngle;\n float clipAngle;\n float flip;\n\n if (enableAlign) {\n axisAngle = (isAxisTitle) ? HALF_PI :\n computeViewAngle(dataPosition, dataPosition + axis);\n clipAngle = computeViewAngle(dataPosition, dataPosition + alignDir);\n\n axisAngle += (sin(axisAngle) < 0.0) ? PI : 0.0;\n clipAngle += (sin(clipAngle) < 0.0) ? PI : 0.0;\n\n flip = (dot(vec2(cos(axisAngle), sin(axisAngle)),\n vec2(sin(clipAngle),-cos(clipAngle))) > 0.0) ? 1.0 : 0.0;\n\n beta += applyAlignOption(clipAngle, flip * PI);\n }\n\n //Compute plane offset\n vec2 planeCoord = position.xy * pixelScale;\n\n mat2 planeXform = scale * mat2(\n cos(beta), sin(beta),\n -sin(beta), cos(beta)\n );\n\n vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;\n\n //Compute clip position\n vec3 clipPosition = project(dataPosition);\n\n //Apply text offset in clip coordinates\n clipPosition += vec3(viewOffset, 0.0);\n\n //Done\n gl_Position = vec4(clipPosition, 1.0);\n}"]),l=n(["precision highp float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}"]);r.text=function(t){return i(t,s,l,null,[{name:"position",type:"vec3"}])};var u=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection;\nuniform vec3 enable;\nuniform vec3 bounds[2];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n\n vec3 signAxis = sign(bounds[1] - bounds[0]);\n\n vec3 realNormal = signAxis * normal;\n\n if(dot(realNormal, enable) > 0.0) {\n vec3 minRange = min(bounds[0], bounds[1]);\n vec3 maxRange = max(bounds[0], bounds[1]);\n vec3 nPosition = mix(minRange, maxRange, 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n\n colorChannel = abs(realNormal);\n}"]),c=n(["precision highp float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] +\n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}"]);r.bg=function(t){return i(t,u,c,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":149,glslify:250}],100:[function(t,e,r){(function(r){"use strict";e.exports=function(t,e,r,a,s,l){var c=n(t),f=i(t,[{buffer:c,size:3}]),h=o(t);h.attributes.position.location=0;var d=new u(t,h,c,f);return d.update(e,r,a,s,l),d};var n=t("gl-buffer"),i=t("gl-vao"),a=t("vectorize-text"),o=t("./shaders").text,s=window||r.global||{},l=s.__TEXT_CACHE||{};s.__TEXT_CACHE={};function u(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}var c=u.prototype,f=[0,0];c.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,f[0]=this.gl.drawingBufferWidth,f[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=f},c.unbind=function(){this.vao.unbind()},c.update=function(t,e,r,n,i){var o=[];function s(t,e,r,n,i,s){var u=l[r];u||(u=l[r]={});var c=u[e];c||(c=u[e]=function(t,e){try{return a(t,e)}catch(e){return console.warn('error vectorizing text:"'+t+'" error:',e),{cells:[],positions:[]}}}(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle",lineSpacing:i,styletags:s}));for(var f=(n||12)/12,h=c.positions,d=c.cells,p=0,g=d.length;p=0;--m){var y=h[v[m]];o.push(f*y[0],-f*y[1],t)}}for(var u=[0,0,0],c=[0,0,0],f=[0,0,0],h=[0,0,0],d={breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},p=0;p<3;++p){f[p]=o.length/3|0,s(.5*(t[0][p]+t[1][p]),e[p],r[p],12,1.25,d),h[p]=(o.length/3|0)-f[p],u[p]=o.length/3|0;for(var g=0;g=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u|=0);var c=""+l;if(o<0&&(c="-"+c),i){for(var f=""+u;f.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r},r.equal=function(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;nr)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function c(t,e){for(var r=n.malloc(t.length,e),i=t.length,a=0;a=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=u(this.gl,this.type,this.length,this.usage,t.data,e):this.length=u(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=n.malloc(t.size,r),l=a(s,t.shape);i.assign(l,t),this.length=u(this.gl,this.type,this.length,this.usage,e<0?s:s.subarray(0,t.size),e),n.free(s)}}else if(Array.isArray(t)){var f;f=this.type===this.gl.ELEMENT_ARRAY_BUFFER?c(t,"uint16"):c(t,"float32"),this.length=u(this.gl,this.type,this.length,this.usage,e<0?f:f.subarray(0,t.length),e),n.free(f)}else if("object"==typeof t&&"number"==typeof t.length)this.length=u(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");(t|=0)<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=function(t,e,r,n){if(r=r||t.ARRAY_BUFFER,n=n||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(n!==t.DYNAMIC_DRAW&&n!==t.STATIC_DRAW&&n!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var i=t.createBuffer(),a=new s(t,r,i,0,n);return a.update(e),a}},{ndarray:286,"ndarray-ops":280,"typedarray-pool":348}],104:[function(t,e,r){"use strict";var n=t("gl-vec3"),i=function(t,e){for(var r=0;r=e)return r-1;return r},a=n.create(),o=n.create(),s=function(t,e,r){return tr?r:t},l=function(t,e,r,l){var u=t[0],c=t[1],f=t[2],h=r[0].length,d=r[1].length,p=r[2].length,g=i(r[0],u),v=i(r[1],c),m=i(r[2],f),y=g+1,b=v+1,x=m+1;if(l&&(g=s(g,0,h-1),y=s(y,0,h-1),v=s(v,0,d-1),b=s(b,0,d-1),m=s(m,0,p-1),x=s(x,0,p-1)),g<0||v<0||m<0||y>=h||b>=d||x>=p)return n.create();var _=(u-r[0][g])/(r[0][y]-r[0][g]),w=(c-r[1][v])/(r[1][b]-r[1][v]),A=(f-r[2][m])/(r[2][x]-r[2][m]);(_<0||_>1||isNaN(_))&&(_=0),(w<0||w>1||isNaN(w))&&(w=0),(A<0||A>1||isNaN(A))&&(A=0);var M=m*h*d,T=x*h*d,k=v*h,E=b*h,L=g,S=y,C=e[k+M+L],O=e[k+M+S],R=e[E+M+L],P=e[E+M+S],z=e[k+T+L],I=e[k+T+S],N=e[E+T+L],D=e[E+T+S],F=n.create();return n.lerp(F,C,O,_),n.lerp(a,R,P,_),n.lerp(F,F,a,w),n.lerp(a,z,I,_),n.lerp(o,N,D,_),n.lerp(a,a,o,w),n.lerp(F,F,a,A),F};e.exports=function(t,e){var r;r=t.positions?t.positions:function(t){for(var e=t[0],r=t[1],n=t[2],i=[],a=0;as&&(s=n.length(x)),b&&(y=Math.min(y,2*n.distance(g,_)/(n.length(v)+n.length(x)))),g=_,v=x,m.push(x)}var w=[u,f,d],A=[c,h,p];e&&(e[0]=w,e[1]=A),0===s&&(s=1);var M=1/s;isFinite(y)&&!isNaN(y)||(y=1),o.vectorScale=y;var T=function(t,e,r){var i=n.create();return void 0!==t&&n.set(i,t,e,r),i}(0,1,0),k=t.coneSize||.5;t.absoluteConeSize&&(k=t.absoluteConeSize*M),o.coneScale=k;b=0;for(var E=0;b=1},b.isTransparent=function(){return this.opacity<1},b.pickSlots=1,b.setPickBase=function(t){this.pickId=t},b.highlight=function(t){if(t&&this.contourEnable){for(var e=h(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=d.mallocFloat32(6*a),s=0,l=0;l0){var p=this.triShader;p.bind(),p.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}},b.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||m,n=t.view||m,i=t.projection||m,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:a,vectorScale:this.vectorScale,coneScale:this.coneScale,coneOffset:this.coneOffset,pickId:this.pickId/255},l=this.pickShader;l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth*this.pixelRatio),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind())},b.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions[r[1]].slice(0,3);return{index:Math.floor(r[1]/48),position:n,dataCoordinate:n}},b.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.pickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleVectors.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleNormals.dispose(),this.triangleIds.dispose(),this.edgeVAO.dispose(),this.edgePositions.dispose(),this.edgeColors.dispose(),this.edgeUVs.dispose(),this.edgeIds.dispose(),this.pointVAO.dispose(),this.pointPositions.dispose(),this.pointColors.dispose(),this.pointUVs.dispose(),this.pointSizes.dispose(),this.pointIds.dispose(),this.contourVAO.dispose(),this.contourPositions.dispose()},e.exports=function(t,e){1===arguments.length&&(t=(e=t).gl);var r=e.triShader||function(t){var e=n(t,g.vertex,g.fragment,null,g.attributes);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.vector.location=5,e}(t),s=x(t),l=o(t,c(new Uint8Array([255,255,255,255]),[1,1,4]));l.generateMipmap(),l.minFilter=t.LINEAR_MIPMAP_LINEAR,l.magFilter=t.LINEAR;var u=i(t),f=i(t),h=i(t),d=i(t),p=i(t),v=i(t),m=a(t,[{buffer:u,type:t.FLOAT,size:4},{buffer:v,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:h,type:t.FLOAT,size:4},{buffer:d,type:t.FLOAT,size:2},{buffer:p,type:t.FLOAT,size:3},{buffer:f,type:t.FLOAT,size:3}]),b=i(t),_=i(t),w=i(t),A=i(t),M=a(t,[{buffer:b,type:t.FLOAT,size:3},{buffer:A,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:_,type:t.FLOAT,size:4},{buffer:w,type:t.FLOAT,size:2}]),T=i(t),k=i(t),E=i(t),L=i(t),S=i(t),C=a(t,[{buffer:T,type:t.FLOAT,size:3},{buffer:S,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:k,type:t.FLOAT,size:4},{buffer:E,type:t.FLOAT,size:2},{buffer:L,type:t.FLOAT,size:1}]),O=i(t),R=new y(t,l,r,s,u,f,v,h,d,p,m,b,A,_,w,M,T,S,k,E,L,C,O,a(t,[{buffer:O,type:t.FLOAT,size:3}]));return R.update(e),R}},{"./shaders":106,colormap:68,"gl-buffer":103,"gl-mat4/invert":124,"gl-mat4/multiply":126,"gl-shader":149,"gl-texture2d":164,"gl-vao":168,ndarray:286,normals:288,"simplicial-complex-contour":330,"typedarray-pool":348}],106:[function(t,e,r){var n=t("glslify"),i=n(["precision highp float;\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n float index = rawIndex - floor(rawIndex /\n (segmentCount * 6.0)) *\n (segmentCount * 6.0);\n\n float segment = floor(0.001 + index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex > 2.99 && segmentIndex < 3.01) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n float nextAngle = (\n (segmentIndex > 0.99 && segmentIndex < 1.01) ||\n (segmentIndex > 4.99 && segmentIndex < 5.01)\n ) ? 1.0 : 0.0;\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex < 3.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\nuniform float vectorScale;\nuniform float coneScale;\n\nuniform float coneOffset;\n\nuniform mat4 model\n , view\n , projection\n , inverseModel;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * conePosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\n f_normal = normalize((vec4(normal,0.0) * inverseModel).xyz);\n\n // vec4 m_position = model * vec4(conePosition, 1.0);\n vec4 t_position = view * conePosition;\n gl_Position = projection * t_position;\n\n f_color = color;\n f_data = conePosition.xyz;\n f_position = position.xyz;\n f_uv = uv;\n}\n"]),a=n(["#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\nfloat cookTorranceSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}\n"]),o=n(["precision highp float;\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n float index = rawIndex - floor(rawIndex /\n (segmentCount * 6.0)) *\n (segmentCount * 6.0);\n\n float segment = floor(0.001 + index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex > 2.99 && segmentIndex < 3.01) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n float nextAngle = (\n (segmentIndex > 0.99 && segmentIndex < 1.01) ||\n (segmentIndex > 4.99 && segmentIndex < 5.01)\n ) ? 1.0 : 0.0;\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex < 3.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nuniform float vectorScale;\nuniform float coneScale;\nuniform float coneOffset;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n gl_Position = projection * view * conePosition;\n f_id = id;\n f_position = position.xyz;\n}\n"]),s=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec4"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec3"}]},r.pickShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec3"}]}},{glslify:250}],107:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34000:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],108:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":107}],109:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e),o=i(e,[{buffer:r,type:e.FLOAT,size:3,offset:0,stride:40},{buffer:r,type:e.FLOAT,size:4,offset:12,stride:40},{buffer:r,type:e.FLOAT,size:3,offset:28,stride:40}]),l=a(e);l.attributes.position.location=0,l.attributes.color.location=1,l.attributes.offset.location=2;var u=new s(e,r,o,l);return u.update(t),u};var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders/index"),o=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function s(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1,this.hasAlpha=!1}var l=s.prototype;function u(t,e){for(var r=0;r<3;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}l.isOpaque=function(){return!this.hasAlpha},l.isTransparent=function(){return this.hasAlpha},l.drawTransparent=l.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||o,i=r.projection=t.projection||o;r.model=t.model||o,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],s=n[13],l=n[14],u=n[15],c=(t._ortho||!1?2:1)*this.pixelRatio*(i[3]*a+i[7]*s+i[11]*l+i[15]*u)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f)e.lineWidth(this.lineWidth[f]*this.pixelRatio),r.capSize=this.capSize[f]*c,this.lineCount[f]&&e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var c=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=[0,0,0];a[(n+e)%3]=i,r.push(a)}t[e]=r}return t}();function f(t,e,r,n){for(var i=c[n],a=0;a0)(g=c.slice())[s]+=d[1][s],i.push(c[0],c[1],c[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),u(this.bounds,g),o+=2+f(i,g,p,s)}}this.lineCount[s]=o-this.lineOffset[s]}this.buffer.update(i)}},l.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":110,"gl-buffer":103,"gl-vao":168}],110:[function(t,e,r){"use strict";var n=t("glslify"),i=t("gl-shader"),a=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}"]),o=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if (\n outOfRange(clipBounds[0], clipBounds[1], fragPosition) ||\n fragColor.a * opacity == 0.\n ) discard;\n\n gl_FragColor = opacity * fragColor;\n}"]);e.exports=function(t){return i(t,a,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},{"gl-shader":149,glslify:250}],111:[function(t,e,r){"use strict";var n=t("gl-texture2d");e.exports=function(t,e,r,n){i||(i=t.FRAMEBUFFER_UNSUPPORTED,a=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,o=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,s=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var u=t.getExtension("WEBGL_draw_buffers");!l&&u&&function(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);l=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;ac||r<0||r>c)throw new Error("gl-fbo: Parameters are too large for FBO");var f=1;if("color"in(n=n||{})){if((f=Math.max(0|n.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(f>1){if(!u)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(f>t.getParameter(u.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+f+" draw buffers")}}var h=t.UNSIGNED_BYTE,d=t.getExtension("OES_texture_float");if(n.float&&f>0){if(!d)throw new Error("gl-fbo: Context does not support floating point textures");h=t.FLOAT}else n.preferFloat&&f>0&&d&&(h=t.FLOAT);var g=!0;"depth"in n&&(g=!!n.depth);var v=!1;"stencil"in n&&(v=!!n.stencil);return new p(t,e,r,h,f,g,v,u)};var i,a,o,s,l=null;function u(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}function c(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function f(t){switch(t){case i:throw new Error("gl-fbo: Framebuffer unsupported");case a:throw new Error("gl-fbo: Framebuffer incomplete attachment");case o:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case s:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function h(t,e,r,i,a,o){if(!i)return null;var s=n(t,e,r,a,i);return s.magFilter=t.NEAREST,s.minFilter=t.NEAREST,s.mipSamples=1,s.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,s.handle,0),s}function d(t,e,r,n,i){var a=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,a),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,a),a}function p(t,e,r,n,i,a,o,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(i);for(var p=0;p1&&s.drawBuffersWEBGL(l[o]);var y=r.getExtension("WEBGL_depth_texture");y?p?t.depth=h(r,i,a,y.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g&&(t.depth=h(r,i,a,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):g&&p?t._depth_rb=d(r,i,a,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g?t._depth_rb=d(r,i,a,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):p&&(t._depth_rb=d(r,i,a,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){for(t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null),m=0;mi||r<0||r>i)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var a=u(n),o=0;o max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float dashScale;\nuniform float opacity;\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (\n outOfRange(clipBounds[0], clipBounds[1], worldPosition) ||\n fragColor.a * opacity == 0.\n ) discard;\n\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n if(dashWeight < 0.5) {\n discard;\n }\n gl_FragColor = fragColor * opacity;\n}\n"]),s=n(["precision highp float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1604150559(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\n\n gl_FragColor = vec4(pickId/255.0, encode_float_1604150559(pixelArcLength).xyz);\n}"]),l=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];r.createShader=function(t){return i(t,a,o,null,l)},r.createPickShader=function(t){return i(t,a,s,null,l)}},{"gl-shader":149,glslify:250}],114:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=c(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var o=f(e);o.attributes.position.location=0,o.attributes.nextPosition.location=1,o.attributes.arcLength.location=2,o.attributes.lineWidth.location=3,o.attributes.color.location=4;for(var s=n(e),u=i(e,[{buffer:s,size:3,offset:0,stride:48},{buffer:s,size:3,offset:12,stride:48},{buffer:s,size:1,offset:24,stride:48},{buffer:s,size:1,offset:28,stride:48},{buffer:s,size:4,offset:32,stride:48}]),h=l(new Array(1024),[256,1,4]),d=0;d<1024;++d)h.data[d]=255;var p=a(e,h);p.wrap=e.REPEAT;var g=new v(e,r,o,s,u,p);return g.update(t),g};var n=t("gl-buffer"),i=t("gl-vao"),a=t("gl-texture2d"),o=t("glsl-read-float"),s=t("binary-search-bounds"),l=t("ndarray"),u=t("./lib/shaders"),c=u.createShader,f=u.createPickShader,h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function d(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function p(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function g(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function v(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.hasAlpha=!1,this.dirty=!0,this.pixelRatio=1}var m=v.prototype;m.isTransparent=function(){return this.hasAlpha},m.isOpaque=function(){return!this.hasAlpha},m.pickSlots=1,m.setPickBase=function(t){this.pickId=t},m.drawTransparent=m.draw=function(t){if(this.vertexCount){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||h,view:t.view||h,projection:t.projection||h,clipBounds:p(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()}},m.drawPick=function(t){if(this.vertexCount){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||h,view:t.view||h,projection:t.projection||h,pickId:this.pickId,clipBounds:p(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()}},m.update=function(t){var e,r;this.dirty=!0;var n=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),this.hasAlpha=!1,"opacity"in t&&(this.opacity=+t.opacity,this.opacity<1&&(this.hasAlpha=!0));var i=[],a=[],o=[],u=0,c=0,f=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],h=t.position||t.positions;if(h){var p=t.color||t.colors||[0,0,0,1],g=t.lineWidth||1,v=!1;t:for(e=1;e0){for(var w=0;w<24;++w)i.push(i[i.length-12]);c+=2,v=!0}continue t}f[0][r]=Math.min(f[0][r],x[r],_[r]),f[1][r]=Math.max(f[1][r],x[r],_[r])}Array.isArray(p[0])?(m=p.length>e-1?p[e-1]:p.length>0?p[p.length-1]:[0,0,0,1],y=p.length>e?p[e]:p.length>0?p[p.length-1]:[0,0,0,1]):m=y=p,3===m.length&&(m=[m[0],m[1],m[2],1]),3===y.length&&(y=[y[0],y[1],y[2],1]),!this.hasAlpha&&m[3]<1&&(this.hasAlpha=!0),b=Array.isArray(g)?g.length>e-1?g[e-1]:g.length>0?g[g.length-1]:[0,0,0,1]:g;var A=u;if(u+=d(x,_),v){for(r=0;r<2;++r)i.push(x[0],x[1],x[2],_[0],_[1],_[2],A,b,m[0],m[1],m[2],m[3]);c+=2,v=!1}i.push(x[0],x[1],x[2],_[0],_[1],_[2],A,b,m[0],m[1],m[2],m[3],x[0],x[1],x[2],_[0],_[1],_[2],A,-b,m[0],m[1],m[2],m[3],_[0],_[1],_[2],x[0],x[1],x[2],u,-b,y[0],y[1],y[2],y[3],_[0],_[1],_[2],x[0],x[1],x[2],u,b,y[0],y[1],y[2],y[3]),c+=4}}if(this.buffer.update(i),a.push(u),o.push(h[h.length-1].slice()),this.bounds=f,this.vertexCount=c,this.points=o,this.arcLength=a,"dashes"in t){var M=t.dashes.slice();for(M.unshift(0),e=1;e1.0001)return null;v+=g[c]}if(Math.abs(v-1)>.001)return null;return[f,function(t,e){for(var r=[0,0,0],n=0;n max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));\n //float specular = max(0.0, beckmann(L, V, N, roughness)); // used in gl-surface3d\n\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}\n"]),o=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}"]),s=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]),l=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}"]),u=n(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]),c=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}"]),f=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]),h=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}"]),d=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}"]),p=n(["precision highp float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:l,fragment:u,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:c,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:d,fragment:p,attributes:[{name:"position",type:"vec3"}]}},{glslify:250}],139:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("normals"),l=t("gl-mat4/multiply"),u=t("gl-mat4/invert"),c=t("ndarray"),f=t("colormap"),h=t("simplicial-complex-contour"),d=t("typedarray-pool"),p=t("./lib/shaders"),g=t("./lib/closest-point"),v=p.meshShader,m=p.wireShader,y=p.pointShader,b=p.pickShader,x=p.pointPickShader,_=p.contourShader,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function A(t,e,r,n,i,a,o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_,A,M,T,k,E){this.gl=t,this.pixelRatio=1,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=h,this.triangleUVs=f,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=v,this.edgeUVs=m,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=A,this.pointSizes=M,this.pointIds=x,this.pointVAO=T,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=E,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=w,this._view=w,this._projection=w,this._resolution=[1,1]}var M=A.prototype;function T(t){var e=n(t,y.vertex,y.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}function k(t){var e=n(t,b.vertex,b.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e}function E(t){var e=n(t,x.vertex,x.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function L(t){var e=n(t,_.vertex,_.fragment);return e.attributes.position.location=0,e}M.isOpaque=function(){return this.opacity>=1},M.isTransparent=function(){return this.opacity<1},M.pickSlots=1,M.setPickBase=function(t){this.pickId=t},M.highlight=function(t){if(t&&this.contourEnable){for(var e=h(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=d.mallocFloat32(6*a),s=0,l=0;l0&&((f=this.triShader).bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind());this.edgeCount>0&&this.lineWidth>0&&((f=this.lineShader).bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth*this.pixelRatio),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind());this.pointCount>0&&((f=this.pointShader).bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind());this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0&&((f=this.contourShader).bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind())},M.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||w,n=t.view||w,i=t.projection||w,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s,l={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255};((s=this.pickShader).bind(),s.uniforms=l,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth*this.pixelRatio),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0)&&((s=this.pointPickShader).bind(),s.uniforms=l,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind())},M.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),a=0;aMath.abs(e))u.rotate(a,0,0,-t*r*Math.PI*p.rotateSpeed/window.innerWidth);else if(!p._ortho){var o=-p.zoomSpeed*i*e/window.innerHeight*(a-u.lastT())/20;u.pan(a,0,0,f*(Math.exp(o)-1))}}},!0)},p.enableMouseListeners(),p};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset"),l=t("has-passive-events")},{"3d-view":10,"has-passive-events":252,"mouse-change":271,"mouse-event-offset":272,"mouse-wheel":274,"right-now":316}],141:[function(t,e,r){var n=t("glslify"),i=t("gl-shader"),a=n(["precision mediump float;\n#define GLSLIFY 1\nattribute vec2 position;\nvarying vec2 uv;\nvoid main() {\n uv = position;\n gl_Position = vec4(position, 0, 1);\n}"]),o=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D accumBuffer;\nvarying vec2 uv;\n\nvoid main() {\n vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0));\n gl_FragColor = min(vec4(1,1,1,1), accum);\n}"]);e.exports=function(t){return i(t,a,o,null,[{name:"position",type:"vec2"}])}},{"gl-shader":149,glslify:250}],142:[function(t,e,r){"use strict";var n=t("./camera.js"),i=t("gl-axes3d"),a=t("gl-axes3d/properties"),o=t("gl-spikes3d"),s=t("gl-select-static"),l=t("gl-fbo"),u=t("a-big-triangle"),c=t("mouse-change"),f=t("mouse-wheel"),h=t("gl-mat4/perspective"),d=t("gl-mat4/ortho"),p=t("./lib/shader"),g=t("is-mobile")({tablet:!0});function v(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function m(t){var e=Math.round(Math.log(Math.abs(t))/Math.log(10));if(e<0){var r=Math.round(Math.pow(10,-e));return Math.ceil(t*r)/r}if(e>0){r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function y(t){return"boolean"!=typeof t||t}e.exports={createScene:function(t){(t=t||{}).camera=t.camera||{};var e=t.canvas;if(!e)if(e=document.createElement("canvas"),t.container){var r=t.container;r.appendChild(e)}else document.body.appendChild(e);var b=t.gl;b||(b=function(t,e){var r=null;try{(r=t.getContext("webgl",e))||(r=t.getContext("experimental-webgl",e))}catch(t){return null}return r}(e,t.glOptions||{premultipliedAlpha:!0,antialias:!0,preserveDrawingBuffer:g}));if(!b)throw new Error("webgl not supported");var x=t.bounds||[[-10,-10,-10],[10,10,10]],_=new v,w=l(b,[b.drawingBufferWidth,b.drawingBufferHeight],{preferFloat:!g}),A=p(b),M=t.cameraObject&&!0===t.cameraObject._ortho||t.camera.projection&&"orthographic"===t.camera.projection.type||!1,T={eye:t.camera.eye||[2,0,0],center:t.camera.center||[0,0,0],up:t.camera.up||[0,1,0],zoomMin:t.camera.zoomMax||.1,zoomMax:t.camera.zoomMin||100,mode:t.camera.mode||"turntable",_ortho:M},k=t.axes||{},E=i(b,k);E.enable=!k.disable;var L=t.spikes||{},S=o(b,L),C=[],O=[],R=[],P=[],z=!0,I=!0,N=new Array(16),D=new Array(16),F={view:null,projection:N,model:D,_ortho:!1},I=!0,j=[b.drawingBufferWidth,b.drawingBufferHeight],B=t.cameraObject||n(e,T),U={gl:b,contextLost:!1,pixelRatio:t.pixelRatio||1,canvas:e,selection:_,camera:B,axes:E,axesPixels:null,spikes:S,bounds:x,objects:C,shape:j,aspect:t.aspectRatio||[1,1,1],pickRadius:t.pickRadius||10,zNear:t.zNear||.01,zFar:t.zFar||1e3,fovy:t.fovy||Math.PI/4,clearColor:t.clearColor||[0,0,0,0],autoResize:y(t.autoResize),autoBounds:y(t.autoBounds),autoScale:!!t.autoScale,autoCenter:y(t.autoCenter),clipToBounds:y(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:F,oncontextloss:null,mouseListener:null,_stopped:!1},V=[b.drawingBufferWidth/U.pixelRatio|0,b.drawingBufferHeight/U.pixelRatio|0];function H(){if(!U._stopped&&U.autoResize){var t=e.parentNode,r=1,n=1;t&&t!==document.body?(r=t.clientWidth,n=t.clientHeight):(r=window.innerWidth,n=window.innerHeight);var i=0|Math.ceil(r*U.pixelRatio),a=0|Math.ceil(n*U.pixelRatio);if(i!==e.width||a!==e.height){e.width=i,e.height=a;var o=e.style;o.position=o.position||"absolute",o.left="0px",o.top="0px",o.width=r+"px",o.height=n+"px",z=!0}}}U.autoResize&&H();function q(){for(var t=C.length,e=P.length,r=0;r0&&0===R[e-1];)R.pop(),P.pop().dispose()}function G(){if(U.contextLost)return!0;b.isContextLost()&&(U.contextLost=!0,U.mouseListener.enabled=!1,U.selection.object=null,U.oncontextloss&&U.oncontextloss())}window.addEventListener("resize",H),U.update=function(t){U._stopped||(t=t||{},z=!0,I=!0)},U.add=function(t){U._stopped||(t.axes=E,C.push(t),O.push(-1),z=!0,I=!0,q())},U.remove=function(t){if(!U._stopped){var e=C.indexOf(t);e<0||(C.splice(e,1),O.pop(),z=!0,I=!0,q())}},U.dispose=function(){if(!U._stopped&&(U._stopped=!0,window.removeEventListener("resize",H),e.removeEventListener("webglcontextlost",G),U.mouseListener.enabled=!1,!U.contextLost)){E.dispose(),S.dispose();for(var t=0;te?1.1:1/1.1;U.aspect[0]*=r,U.aspect[1]*=r,U.aspect[2]*=r,U.redraw()}},!0),U._mouseRotating=!1,U._prevButtons=0,U.enableMouseListeners=function(){U.mouseListener=c(e,function(t,e,r){if(!U._stopped){var n=P.length,i=C.length,a=_.object;_.distance=1/0,_.mouse[0]=e,_.mouse[1]=r,_.object=null,_.screen=null,_.dataCoordinate=_.dataPosition=null;var o=!1;if(t&&U._prevButtons)U._mouseRotating=!0;else{U._mouseRotating&&(I=!0),U._mouseRotating=!1;for(var s=0;s_.distance)continue;for(var u=0;u1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n);return t[0]=s*u+l*d,t[1]=s*c+l*p,t[2]=s*f+l*g,t[3]=s*h+l*v,t}},{}],144:[function(t,e,r){"use strict";e.exports=function(t){return t||0===t?t.toString():""}},{}],145:[function(t,e,r){"use strict";var n=t("vectorize-text");e.exports=function(t,e,r){var a=i[e];a||(a=i[e]={});if(t in a)return a[t];var o={textAlign:"center",textBaseline:"middle",lineHeight:1,font:e,lineSpacing:1.25,styletags:{breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},triangles:!0},s=n(t,o);o.triangles=!1;var l,u,c=n(t,o);if(r&&1!==r){for(l=0;l max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = 1.0;\n if(distance(highlightId, id) < 0.0001) {\n scale = highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1);\n vec4 viewPosition = view * worldPosition;\n viewPosition = viewPosition / viewPosition.w;\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}"]),o=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = pixelRatio;\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\n scale *= highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1.0);\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n\n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}"]),s=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0,0,0,0);\n } else {\n float lscale = pixelRatio * scale;\n if(distance(highlightId, id) < 0.0001) {\n lscale *= highlightScale;\n }\n\n vec4 clipCenter = projection * view * model * vec4(position, 1);\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = dataPosition;\n }\n}\n"]),l=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (\n outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate) ||\n interpColor.a * opacity == 0.\n ) discard;\n gl_FragColor = interpColor * opacity;\n}\n"]),u=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;\n\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n}"]),c=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],f={vertex:a,fragment:l,attributes:c},h={vertex:o,fragment:l,attributes:c},d={vertex:s,fragment:l,attributes:c},p={vertex:a,fragment:u,attributes:c},g={vertex:o,fragment:u,attributes:c},v={vertex:s,fragment:u,attributes:c};function m(t,e){var r=n(t,e),i=r.attributes;return i.position.location=0,i.color.location=1,i.glyph.location=2,i.id.location=3,r}r.createPerspective=function(t){return m(t,f)},r.createOrtho=function(t){return m(t,h)},r.createProject=function(t){return m(t,d)},r.createPickPerspective=function(t){return m(t,p)},r.createPickOrtho=function(t){return m(t,g)},r.createPickProject=function(t){return m(t,v)}},{"gl-shader":149,glslify:250}],147:[function(t,e,r){"use strict";var n=t("is-string-blank"),i=t("gl-buffer"),a=t("gl-vao"),o=t("typedarray-pool"),s=t("gl-mat4/multiply"),l=t("./lib/shaders"),u=t("./lib/glyphs"),c=t("./lib/get-simple-string"),f=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function h(t,e){var r=t[0],n=t[1],i=t[2],a=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*a,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*a,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*a,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*a,t}function d(t,e,r,n){return h(n,n),h(n,n),h(n,n)}function p(t,e){this.index=t,this.dataCoordinate=this.position=e}function g(t){return!0===t?1:t>1?1:t}function v(t,e,r,n,i,a,o,s,l,u,c,f){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=o,this.idBuffer=s,this.vao=l,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.hasAlpha=!1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.projectHasAlpha=!1,this.pickId=0,this.pickPerspectiveShader=u,this.pickOrthoShader=c,this.pickProjectShader=f,this.points=[],this._selectResult=new p(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.dirty=!0}e.exports=function(t){var e=t.gl,r=l.createPerspective(e),n=l.createOrtho(e),o=l.createProject(e),s=l.createPickPerspective(e),u=l.createPickOrtho(e),c=l.createPickProject(e),f=i(e),h=i(e),d=i(e),p=i(e),g=a(e,[{buffer:f,size:3,type:e.FLOAT},{buffer:h,size:4,type:e.FLOAT},{buffer:d,size:2,type:e.FLOAT},{buffer:p,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),m=new v(e,r,n,o,f,h,d,p,g,s,u,c);return m.update(t),m};var m=v.prototype;m.pickSlots=1,m.setPickBase=function(t){this.pickId=t},m.isTransparent=function(){if(this.hasAlpha)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectHasAlpha)return!0;return!1},m.isOpaque=function(){if(!this.hasAlpha)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&!this.projectHasAlpha)return!0;return!1};var y=[0,0],b=[0,0,0],x=[0,0,0],_=[0,0,0,1],w=[0,0,0,1],A=f.slice(),M=[0,0,0],T=[[0,0,0],[0,0,0]];function k(t){return t[0]=t[1]=t[2]=0,t}function E(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function L(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function S(t,e,r,n){var i,a=e.axesProject,o=e.gl,l=t.uniforms,u=r.model||f,c=r.view||f,h=r.projection||f,p=e.axesBounds,g=function(t){for(var e=T,r=0;r<2;++r)for(var n=0;n<3;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}(e.clipBounds);i=e.axes&&e.axes.lastCubeProps?e.axes.lastCubeProps.axis:[1,1,1],y[0]=2/o.drawingBufferWidth,y[1]=2/o.drawingBufferHeight,t.bind(),l.view=c,l.projection=h,l.screenSize=y,l.highlightId=e.highlightId,l.highlightScale=e.highlightScale,l.clipBounds=g,l.pickGroup=e.pickId/255,l.pixelRatio=n;for(var v=0;v<3;++v)if(a[v]){l.scale=e.projectScale[v],l.opacity=e.projectOpacity[v];for(var m=A,S=0;S<16;++S)m[S]=0;for(S=0;S<4;++S)m[5*S]=1;m[5*v]=0,i[v]<0?m[12+v]=p[0][v]:m[12+v]=p[1][v],s(m,u,m),l.model=m;var C=(v+1)%3,O=(v+2)%3,R=k(b),P=k(x);R[C]=1,P[O]=1;var z=d(0,0,0,E(_,R)),I=d(0,0,0,E(w,P));if(Math.abs(z[1])>Math.abs(I[1])){var N=z;z=I,I=N,N=R,R=P,P=N;var D=C;C=O,O=D}z[0]<0&&(R[C]=-1),I[1]>0&&(P[O]=-1);var F=0,j=0;for(S=0;S<4;++S)F+=Math.pow(u[4*C+S],2),j+=Math.pow(u[4*O+S],2);R[C]/=Math.sqrt(F),P[O]/=Math.sqrt(j),l.axes[0]=R,l.axes[1]=P,l.fragClipBounds[0]=L(M,g[0],v,-1e8),l.fragClipBounds[1]=L(M,g[1],v,1e8),e.vao.bind(),e.vao.draw(o.TRIANGLES,e.vertexCount),e.lineWidth>0&&(o.lineWidth(e.lineWidth*n),e.vao.draw(o.LINES,e.lineVertexCount,e.vertexCount)),e.vao.unbind()}}var C=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];function O(t,e,r,n,i,a,o){var s=r.gl;if((a===r.projectHasAlpha||o)&&S(e,r,n,i),a===r.hasAlpha||o){t.bind();var l=t.uniforms;l.model=n.model||f,l.view=n.view||f,l.projection=n.projection||f,y[0]=2/s.drawingBufferWidth,y[1]=2/s.drawingBufferHeight,l.screenSize=y,l.highlightId=r.highlightId,l.highlightScale=r.highlightScale,l.fragClipBounds=C,l.clipBounds=r.axes.bounds,l.opacity=r.opacity,l.pickGroup=r.pickId/255,l.pixelRatio=i,r.vao.bind(),r.vao.draw(s.TRIANGLES,r.vertexCount),r.lineWidth>0&&(s.lineWidth(r.lineWidth*i),r.vao.draw(s.LINES,r.lineVertexCount,r.vertexCount)),r.vao.unbind()}}function R(t,e,r,i){var a;a=Array.isArray(t)?e=this.pointCount||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},m.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},m.update=function(t){if("perspective"in(t=t||{})&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if(this.projectHasAlpha=!1,"projectOpacity"in t){if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{r=+t.projectOpacity;this.projectOpacity=[r,r,r]}for(var n=0;n<3;++n)this.projectOpacity[n]=g(this.projectOpacity[n]),this.projectOpacity[n]<1&&(this.projectHasAlpha=!0)}this.hasAlpha=!1,"opacity"in t&&(this.opacity=g(t.opacity),this.opacity<1&&(this.hasAlpha=!0)),this.dirty=!0;var i,a,s=t.position,l=t.font||"normal",u=t.alignment||[0,0];if(2===u.length)i=u[0],a=u[1];else{i=[],a=[];for(n=0;n0){var P=0,z=b,I=[0,0,0,1],N=[0,0,0,1],D=Array.isArray(d)&&Array.isArray(d[0]),F=Array.isArray(m)&&Array.isArray(m[0]);t:for(n=0;n<_;++n){y+=1;for(w=s[n],A=0;A<3;++A){if(isNaN(w[A])||!isFinite(w[A]))continue t;f[A]=Math.max(f[A],w[A]),c[A]=Math.min(c[A],w[A])}M=(j=R(h,n,l,this.pixelRatio)).mesh,T=j.lines,k=j.bounds;var j,B=j.visible;if(B)if(Array.isArray(d)){if(3===(U=D?n0?1-k[0][0]:X<0?1+k[1][0]:1,W*=W>0?1-k[0][1]:W<0?1+k[1][1]:1],Z=M.cells||[],Q=M.positions||[];for(A=0;Athis.buffer.length){i.free(this.buffer);for(var n=this.buffer=i.mallocUint8(o(r*e*4)),a=0;ar)for(t=r;te)for(t=e;t=0){for(var A=0|w.type.charAt(w.type.length-1),M=new Array(A),T=0;T=0;)k+=1;_[y]=k}var E=new Array(r.length);function L(){h.program=o.program(d,h._vref,h._fref,x,_);for(var t=0;t=0){var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new n("","Invalid data type for attribute "+f+": "+h);o(t,e,d[0],i,p,a,f)}else{if(!(h.indexOf("mat")>=0))throw new n("","Unknown data type for attribute "+f+": "+h);var p=h.charCodeAt(h.length-1)-48;if(p<2||p>4)throw new n("","Invalid data type for attribute "+f+": "+h);s(t,e,d,i,p,a,f)}}}return a};var n=t("./GLError");function i(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}var a=i.prototype;function o(t,e,r,n,a,o,s){for(var l=["gl","v"],u=[],c=0;c4)throw new i("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+a+"fv(locations["+e+"],false,obj"+t+")"}throw new i("","Unknown uniform data type for "+name+": "+r)}var a=r.charCodeAt(r.length-1)-48;if(a<2||a>4)throw new i("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+a+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+a+"fv(locations["+e+"],obj"+t+")";default:throw new i("","Unrecognized data type for vector "+name+": "+r)}}}function u(e){for(var n=["return function updateProperty(obj){"],i=function t(e,r){if("object"!=typeof r)return[[e,r]];var n=[];for(var i in r){var a=r[i],o=e;parseInt(i)+""===i?o+="["+i+"]":o+="."+i,"object"==typeof a?n.push.apply(n,t(o,a)):n.push([o,a])}return n}("",e),a=0;a4)throw new i("","Invalid data type");return"b"===t.charAt(0)?o(r,!1):o(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new i("","Invalid uniform dimension type for matrix "+name+": "+t);return o(r*r,0)}throw new i("","Unknown uniform data type for "+name+": "+t)}}(r[c].type);var d}function f(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var u=1;u1)for(var l=0;l 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the tube vertex and normal at the given index.\n//\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\n//\n// Each tube segment is made up of a ring of vertices.\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\n// The indexes of tube segments run from 0 to 8.\n//\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\n float segmentCount = 8.0;\n\n float angle = 2.0 * 3.14159 * (index / segmentCount);\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d);\n vec3 y = v * sin(angle) * length(d);\n vec3 v3 = x + y;\n\n normal = normalize(v3);\n\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\nuniform float vectorScale;\nuniform float tubeScale;\n\nuniform mat4 model\n , view\n , projection\n , inverseModel;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * tubePosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\n f_normal = normalize((vec4(normal,0.0) * inverseModel).xyz);\n\n // vec4 m_position = model * vec4(tubePosition, 1.0);\n vec4 t_position = view * tubePosition;\n gl_Position = projection * t_position;\n\n f_color = color;\n f_data = tubePosition.xyz;\n f_position = position.xyz;\n f_uv = uv;\n}\n"]),a=n(["#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\nfloat cookTorranceSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data\n , f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}\n"]),o=n(["precision highp float;\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the tube vertex and normal at the given index.\n//\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\n//\n// Each tube segment is made up of a ring of vertices.\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\n// The indexes of tube segments run from 0 to 8.\n//\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\n float segmentCount = 8.0;\n\n float angle = 2.0 * 3.14159 * (index / segmentCount);\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d);\n vec3 y = v * sin(angle) * length(d);\n vec3 v3 = x + y;\n\n normal = normalize(v3);\n\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float tubeScale;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n\n gl_Position = projection * view * tubePosition;\n f_id = id;\n f_position = position.xyz;\n}\n"]),s=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec4"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec4"}]},r.pickShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec4"}]}},{glslify:250}],159:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("normals"),l=t("gl-mat4/multiply"),u=t("gl-mat4/invert"),c=t("ndarray"),f=t("colormap"),h=t("simplicial-complex-contour"),d=t("typedarray-pool"),p=t("./shaders"),g=p.meshShader,v=p.pickShader,m=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function y(t,e,r,n,i,a,o,s,l,u,c,f,h,d,p,g,v,y,b,x,_,w,A,M){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.pickShader=n,this.trianglePositions=i,this.triangleVectors=a,this.triangleColors=s,this.triangleNormals=u,this.triangleUVs=l,this.triangleIds=o,this.triangleVAO=c,this.triangleCount=0,this.lineWidth=1,this.edgePositions=f,this.edgeColors=d,this.edgeUVs=p,this.edgeIds=h,this.edgeVAO=g,this.edgeCount=0,this.pointPositions=v,this.pointColors=b,this.pointUVs=x,this.pointSizes=_,this.pointIds=y,this.pointVAO=w,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=M,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!1,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this.tubeScale=1,this._model=m,this._view=m,this._projection=m,this._resolution=[1,1],this.pixelRatio=1}var b=y.prototype;function x(t){var e=n(t,v.vertex,v.fragment,null,v.attributes);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.vector.location=5,e}b.isOpaque=function(){return this.opacity>=1},b.isTransparent=function(){return this.opacity<1},b.pickSlots=1,b.setPickBase=function(t){this.pickId=t},b.highlight=function(t){if(t&&this.contourEnable){for(var e=h(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=d.mallocFloat32(6*a),s=0,l=0;l0){var p=this.triShader;p.bind(),p.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}},b.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||m,n=t.view||m,i=t.projection||m,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:a,tubeScale:this.tubeScale,pickId:this.pickId/255},l=this.pickShader;l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth*this.pixelRatio),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind())},b.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions[r[1]].slice(0,3);return{index:e,position:n,intensity:this.intensity[r[1]],velocity:this.vectors[r[1]].slice(0,3),divergence:this.vectors[r[1]][3],dataCoordinate:n}},b.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.pickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleVectors.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleNormals.dispose(),this.triangleIds.dispose(),this.edgeVAO.dispose(),this.edgePositions.dispose(),this.edgeColors.dispose(),this.edgeUVs.dispose(),this.edgeIds.dispose(),this.pointVAO.dispose(),this.pointPositions.dispose(),this.pointColors.dispose(),this.pointUVs.dispose(),this.pointSizes.dispose(),this.pointIds.dispose(),this.contourVAO.dispose(),this.contourPositions.dispose()},e.exports=function(t,e){1===arguments.length&&(t=(e=t).gl);var r=e.triShader||function(t){var e=n(t,g.vertex,g.fragment,null,g.attributes);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.vector.location=5,e}(t),s=x(t),l=o(t,c(new Uint8Array([255,255,255,255]),[1,1,4]));l.generateMipmap(),l.minFilter=t.LINEAR_MIPMAP_LINEAR,l.magFilter=t.LINEAR;var u=i(t),f=i(t),h=i(t),d=i(t),p=i(t),v=i(t),m=a(t,[{buffer:u,type:t.FLOAT,size:4},{buffer:v,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:h,type:t.FLOAT,size:4},{buffer:d,type:t.FLOAT,size:2},{buffer:p,type:t.FLOAT,size:3},{buffer:f,type:t.FLOAT,size:4}]),b=i(t),_=i(t),w=i(t),A=i(t),M=a(t,[{buffer:b,type:t.FLOAT,size:3},{buffer:A,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:_,type:t.FLOAT,size:4},{buffer:w,type:t.FLOAT,size:2}]),T=i(t),k=i(t),E=i(t),L=i(t),S=i(t),C=a(t,[{buffer:T,type:t.FLOAT,size:3},{buffer:S,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:k,type:t.FLOAT,size:4},{buffer:E,type:t.FLOAT,size:2},{buffer:L,type:t.FLOAT,size:1}]),O=i(t),R=new y(t,l,r,s,u,f,v,h,d,p,m,b,A,_,w,M,T,S,k,E,L,C,O,a(t,[{buffer:O,type:t.FLOAT,size:3}]));return R.update(e),R}},{"./shaders":158,colormap:68,"gl-buffer":103,"gl-mat4/invert":124,"gl-mat4/multiply":126,"gl-shader":149,"gl-texture2d":164,"gl-vao":168,ndarray:286,normals:288,"simplicial-complex-contour":330,"typedarray-pool":348}],160:[function(t,e,r){"use strict";var n=t("gl-vec3"),i=t("gl-vec4"),a=function(t,e,r,a){for(var o=0,s=0;so&&(o=c)}var f=t.map(function(t){return function(t,e,r,a){var o,s,l,u=t.points,c=t.velocities,f=t.divergences;n.set(n.create(),0,1,0),n.create(),n.create();n.create();for(var h=[],d=[],p=[],g=[],v=[],m=[],y=0,b=0,x=i.create(),_=i.create(),w=0;w0)for(A=0;A<8;A++){var M=(A+1)%8;h.push(g[A],v[A],v[M],v[M],g[M],g[A]),p.push(_,x,x,x,_,_),m.push(y,b,b,b,y,y),d.push([h.length-6,h.length-5,h.length-4],[h.length-3,h.length-2,h.length-1])}var T=g;g=v,v=T,T=_,_=x,x=T,T=y,y=b,b=T}return{positions:h,cells:d,vectors:p,vertexIntensity:m}}(t,r,a,o)}),h=[],d=[],p=[],g=[];for(s=0;se)return r-1}return r},u=n.create(),c=n.create(),f=function(t,e,r){return tr?r:t},h=function(t,e,r,i){var a=t[0],o=t[1],s=t[2],h=r[0].length,d=r[1].length,p=r[2].length,g=l(r[0],a),v=l(r[1],o),m=l(r[2],s),y=g+1,b=v+1,x=m+1;if(r[0][g]===a&&(y=g),r[1][v]===o&&(b=v),r[2][m]===s&&(x=m),i&&(g=f(g,0,h-1),y=f(y,0,h-1),v=f(v,0,d-1),b=f(b,0,d-1),m=f(m,0,p-1),x=f(x,0,p-1)),g<0||v<0||m<0||y>=h||b>=d||x>=p)return n.create();var _=(a-r[0][g])/(r[0][y]-r[0][g]),w=(o-r[1][v])/(r[1][b]-r[1][v]),A=(s-r[2][m])/(r[2][x]-r[2][m]);(_<0||_>1||isNaN(_))&&(_=0),(w<0||w>1||isNaN(w))&&(w=0),(A<0||A>1||isNaN(A))&&(A=0);var M=m*h*d,T=x*h*d,k=v*h,E=b*h,L=g,S=y,C=e[k+M+L],O=e[k+M+S],R=e[E+M+L],P=e[E+M+S],z=e[k+T+L],I=e[k+T+S],N=e[E+T+L],D=e[E+T+S],F=n.create();return n.lerp(F,C,O,_),n.lerp(u,R,P,_),n.lerp(F,F,u,w),n.lerp(u,z,I,_),n.lerp(c,N,D,_),n.lerp(u,u,c,w),n.lerp(F,F,u,A),F},d=function(t){var e=1/0;t.sort(function(t,e){return t-e});for(var r=1;r=f&&r<=g&&n>=h&&n<=v&&i>=p&&i<=m},b=10*n.distance(e[0],e[1])/i,x=b*b,_=1,w=0;n.create();r.length>=2&&(_=function(t){for(var e=[],r=[],n=[],i={},a={},o={},s=0;sw&&!isNaN(z)&&isFinite(z)&&(w=z),S.push(z),c.push({points:T,velocities:k,divergences:S});for(var O=0;O<100*i&&T.lengthx&&n.scale(R,R,b/Math.sqrt(P)),n.add(R,R,M),E=t.getVelocity(R),n.squaredDistance(L,R)-x>-1e-4*x){T.push(R),L=R,k.push(E);C=t.getDivergence(R,E);(z=n.length(C))>w&&!isNaN(z)&&isFinite(z)&&(w=z),S.push(z)}M=R}}for(A=0;A max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n if ((kill > 0.0) ||\n (outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard;\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = max(beckmannSpecular(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor =\n step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) +\n step(.5, vertexColor) * vColor;\n\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n"]),s=i(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform vec3 objectOffset;\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n worldCoordinate = objectOffset + dataCoordinate;\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z += zOffset;\n\n gl_Position = clipPosition;\n value = f + objectOffset.z;\n kill = -1.0;\n planeCoordinate = uv.zw;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n"]),l=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if ((kill > 0.0) ||\n (outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard;\n\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n"]);r.createShader=function(t){var e=n(t,a,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,a,l,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,s,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,s,l,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":149,glslify:250}],162:[function(t,e,r){arguments[4][54][0].apply(r,arguments)},{dup:54}],163:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=y(e),n=x(e),s=b(e),l=_(e),u=i(e),c=a(e,[{buffer:u,size:4,stride:w,offset:0},{buffer:u,size:3,stride:w,offset:16},{buffer:u,size:3,stride:w,offset:28}]),f=i(e),h=a(e,[{buffer:f,size:4,stride:20,offset:0},{buffer:f,size:1,stride:20,offset:16}]),d=i(e),p=a(e,[{buffer:d,size:2,type:e.FLOAT}]),g=o(e,1,E,e.RGBA,e.UNSIGNED_BYTE);g.minFilter=e.LINEAR,g.magFilter=e.LINEAR;var v=new L(e,[0,0],[[0,0,0],[0,0,0]],r,n,u,c,g,s,l,f,h,d,p,[0,0,0]),m={levels:[[],[],[]]};for(var A in t)m[A]=t[A];return m.colormap=m.colormap||"jet",v.update(m),v};var n=t("bit-twiddle"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("typedarray-pool"),l=t("colormap"),u=t("ndarray-ops"),c=t("ndarray-pack"),f=t("ndarray"),h=t("surface-nets"),d=t("gl-mat4/multiply"),p=t("gl-mat4/invert"),g=t("binary-search-bounds"),v=t("ndarray-gradient"),m=t("./lib/shaders"),y=m.createShader,b=m.createContourShader,x=m.createPickShader,_=m.createPickContourShader,w=40,A=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],M=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],T=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];function k(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}!function(){for(var t=0;t<3;++t){var e=T[t],r=(t+2)%3;e[(t+1)%3+0]=1,e[r+3]=1,e[t+6]=1}}();var E=256;function L(t,e,r,n,i,a,o,l,u,c,h,d,p,g,v){this.gl=t,this.shape=e,this.bounds=r,this.objectOffset=v,this.intensityBounds=[],this._shader=n,this._pickShader=i,this._coordinateBuffer=a,this._vao=o,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=d,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new k([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=p,this._dynamicVAO=g,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[f(s.mallocFloat(1024),[0,0]),f(s.mallocFloat(1024),[0,0]),f(s.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.snapToData=!1,this.pixelRatio=1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}var S=L.prototype;S.isTransparent=function(){return this.opacity<1},S.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},S.pickSlots=1,S.setPickBase=function(t){this.pickId=t};var C=[0,0,0],O={showSurface:!1,showContour:!1,projections:[A.slice(),A.slice(),A.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function R(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||C,o=e.showSurface,s=e.showContour;for(r=0;r<3;++r)for(o=o||e.surfaceProject[r],n=0;n<3;++n)s=s||e.contourProject[r][n];for(r=0;r<3;++r){var l=O.projections[r];for(n=0;n<16;++n)l[n]=0;for(n=0;n<4;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(a[r]>0)][r],d(l,t.model,l);var u=O.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return O.showSurface=o,O.showContour=s,O}var P={model:A,view:A,projection:A,inverseModel:A.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,objectOffset:[0,0,0],kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},z=A.slice(),I=[1,0,0,0,1,0,0,0,1];function N(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=P;n.model=t.model||A,n.view=t.view||A,n.projection=t.projection||A,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.objectOffset=this.objectOffset,n.contourColor=this.contourColor[0],n.inverseModel=p(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],o=0;o<3;++o)a[o]=Math.min(Math.max(this.clipBounds[i][o],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=I,n.vertexColor=this.vertexColor;var s=z;for(d(s,n.view,n.model),d(s,n.projection,s),p(s,s),i=0;i<3;++i)n.eyePosition[i]=s[12+i]/s[15];var l=s[15];for(i=0;i<3;++i)l+=this.lightPosition[i]*s[4*i+3];for(i=0;i<3;++i){var u=s[12+i];for(o=0;o<3;++o)u+=s[4*o+i]*this.lightPosition[o];n.lightPosition[i]=u/l}var c=R(n,this);if(c.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;i<3;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=c.projections[i],this._shader.uniforms.clipBounds=c.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(c.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var h=this._contourVAO;for(h.bind(),i=0;i<3;++i)for(f.uniforms.permutation=T[i],r.lineWidth(this.contourWidth[i]*this.pixelRatio),o=0;o>4)/16)/255,i=Math.floor(n),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var f=c?a:1-a,h=0;h<2;++h)for(var d=i+c,p=s+h,v=f*(h?l:1-l),m=0;m<3;++m)u[m]+=this._field[m].get(d,p)*v;for(var y=this._pickResult.level,b=0;b<3;++b)if(y[b]=g.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]Math.abs(_-u[b])&&(y[b]+=1)}for(r.index[0]=a<.5?i:i+1,r.index[1]=l<.5?s:s+1,r.uv[0]=n/e[0],r.uv[1]=o/e[1],m=0;m<3;++m)r.dataCoordinate[m]=this._field[m].get(r.index[0],r.index[1]);return r},S.padField=function(t,e){var r=e.shape.slice(),n=t.shape.slice();u.assign(t.lo(1,1).hi(r[0],r[1]),e),u.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),u.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),u.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),u.assign(t.lo(n[0]-1,1).hi(1,r[1]),e.lo(r[0]-1)),t.set(0,0,e.get(0,0)),t.set(0,n[1]-1,e.get(0,r[1]-1)),t.set(n[0]-1,0,e.get(r[0]-1,0)),t.set(n[0]-1,n[1]-1,e.get(r[0]-1,r[1]-1))},S.update=function(t){t=t||{},this.objectOffset=t.objectOffset||this.objectOffset,this.dirty=!0,"contourWidth"in t&&(this.contourWidth=F(t.contourWidth,Number)),"showContour"in t&&(this.showContour=F(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=F(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=B(t.contourColor)),"contourProject"in t&&(this.contourProject=F(t.contourProject,function(t){return F(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=B(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=F(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=F(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var i=(e.shape[0]+2)*(e.shape[1]+2);i>this._field[2].data.length&&(s.freeFloat(this._field[2].data),this._field[2].data=s.mallocFloat(n.nextPow2(i))),this._field[2]=f(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),this.padField(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(s.freeFloat(this._field[o].data),this._field[o].data=s.mallocFloat(this._field[2].size)),this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var d=t.coords;if(!Array.isArray(d)||3!==d.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var p=d[o];for(x=0;x<2;++x)if(p.shape[x]!==a[x])throw new Error("gl-surface: coords have incorrect shape");this.padField(this._field[o],p)}}else if(t.ticks){var g=t.ticks;if(!Array.isArray(g)||2!==g.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var m=g[o];if((Array.isArray(m)||m.length)&&(m=f(m)),m.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var y=f(m.data,a);y.stride[o]=m.stride[0],y.stride[1^o]=0,this.padField(this._field[o],y)}}else{for(o=0;o<2;++o){var b=[0,0];b[o]=1,this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2],b,0)}this._field[0].set(0,0,0);for(var x=0;x0){for(var At=0;At<5;++At)rt.pop();G-=1}continue t}rt.push(st[0],st[1],ct[0],ct[1],st[2]),G+=1}}ot.push(G)}this._contourOffsets[nt]=at,this._contourCounts[nt]=ot}var Mt=s.mallocFloat(rt.length);for(o=0;os||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=p(o,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,l=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,l=!1,r="uint8");var f,d,v=0;if(2===o.length)v=t.LUMINANCE,o=[o[0],o[1],1],e=n(e.data,o,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==o.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===o[2])v=t.ALPHA;else if(2===o[2])v=t.LUMINANCE_ALPHA;else if(3===o[2])v=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");v=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,l=!1);var m=e.size;if(l)f=0===e.offset&&e.data.length===m?e.data:e.data.subarray(e.offset,e.offset+m);else{var y=[o[2],o[2]*o[0],1];d=a.malloc(m,r);var b=n(d,o,y,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?i.assign(b,e):c(b,e),f=d.subarray(0,m)}var x=g(t);t.texImage2D(t.TEXTURE_2D,0,v,o[0],o[1],0,v,u,f),l||a.free(d);return new h(t,x,o[0],o[1],v,u)}(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var o=null,s=null,l=null;function u(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement||"undefined"!=typeof ImageData&&t instanceof ImageData}var c=function(t,e){i.muls(t,e,255)};function f(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function h(t,e,r,n,i,a){this.gl=t,this.handle=e,this.format=i,this.type=a,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return o._wrapS},set:function(t){return o.wrapS=t}},{get:function(){return o._wrapT},set:function(t){return o.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(t){return o.width=t}},{get:function(){return o._shape[1]},set:function(t){return o.height=t}}]),this._shapeVector=l}var d=h.prototype;function p(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function g(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function v(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=g(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new h(t,o,e,r,n,i)}Object.defineProperties(d,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&o.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),s.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&o.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),s.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=this.gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),l.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),l.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(l.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return f(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return f(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,f(this,this._shape[0],t),t}}}),d.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},d.dispose=function(){this.gl.deleteTexture(this.handle)},d.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},d.setPixels=function(t,e,r,o){var s=this.gl;this.bind(),Array.isArray(e)?(o=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),o=o||0;var l=u(t)?t:t.raw;if(l){this._mipLevels.indexOf(o)<0?(s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,this.type,l),this._mipLevels.push(o)):s.texSubImage2D(s.TEXTURE_2D,o,e,r,this.format,this.type,l)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>o||r+t.shape[0]>this._shape[0]>>>o||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");!function(t,e,r,o,s,l,u,f){var h=f.dtype,d=f.shape.slice();if(d.length<2||d.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var g=0,v=0,m=p(d,f.stride.slice());"float32"===h?g=t.FLOAT:"float64"===h?(g=t.FLOAT,m=!1,h="float32"):"uint8"===h?g=t.UNSIGNED_BYTE:(g=t.UNSIGNED_BYTE,m=!1,h="uint8");if(2===d.length)v=t.LUMINANCE,d=[d[0],d[1],1],f=n(f.data,d,[f.stride[0],f.stride[1],1],f.offset);else{if(3!==d.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===d[2])v=t.ALPHA;else if(2===d[2])v=t.LUMINANCE_ALPHA;else if(3===d[2])v=t.RGB;else{if(4!==d[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");v=t.RGBA}d[2]}v!==t.LUMINANCE&&v!==t.ALPHA||s!==t.LUMINANCE&&s!==t.ALPHA||(v=s);if(v!==s)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=f.size,b=u.indexOf(o)<0;b&&u.push(o);if(g===l&&m)0===f.offset&&f.data.length===y?b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,f.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,f.data):b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,f.data.subarray(f.offset,f.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,f.data.subarray(f.offset,f.offset+y));else{var x;x=l===t.FLOAT?a.mallocFloat32(y):a.mallocUint8(y);var _=n(x,d,[d[2],d[2]*d[0],1]);g===t.FLOAT&&l===t.UNSIGNED_BYTE?c(_,f):i.assign(_,f),b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,x.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,x.subarray(0,y)),l===t.FLOAT?a.freeFloat32(x):a.freeUint8(x)}}(s,e,r,o,this.format,this.type,this._mipLevels,t)}}},{ndarray:286,"ndarray-ops":280,"typedarray-pool":348}],165:[function(t,e,r){"use strict";e.exports=function(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i1?0:Math.acos(s)};var n=t("./fromValues"),i=t("./normalize"),a=t("./dot")},{"./dot":180,"./fromValues":186,"./normalize":197}],171:[function(t,e,r){e.exports=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}},{}],172:[function(t,e,r){e.exports=function(t){var e=new Float32Array(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}},{}],173:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}},{}],174:[function(t,e,r){e.exports=function(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}},{}],175:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=i*l-a*s,t[1]=a*o-n*l,t[2]=n*s-i*o,t}},{}],176:[function(t,e,r){e.exports=t("./distance")},{"./distance":177}],177:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(r*r+n*n+i*i)}},{}],178:[function(t,e,r){e.exports=t("./divide")},{"./divide":179}],179:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}},{}],180:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],181:[function(t,e,r){e.exports=1e-6},{}],182:[function(t,e,r){e.exports=function(t,e){var r=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(r-o)<=n*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=n*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=n*Math.max(1,Math.abs(a),Math.abs(l))};var n=t("./epsilon")},{"./epsilon":181}],183:[function(t,e,r){e.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}},{}],184:[function(t,e,r){e.exports=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}},{}],185:[function(t,e,r){e.exports=function(t,e,r,i,a,o){var s,l;e||(e=3);r||(r=0);l=i?Math.min(i*e+r,t.length):t.length;for(s=r;s0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a);return t}},{}],198:[function(t,e,r){e.exports=function(t,e){e=e||1;var r=2*Math.random()*Math.PI,n=2*Math.random()-1,i=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*i,t[1]=Math.sin(r)*i,t[2]=n*e,t}},{}],199:[function(t,e,r){e.exports=function(t,e,r,n){var i=r[1],a=r[2],o=e[1]-i,s=e[2]-a,l=Math.sin(n),u=Math.cos(n);return t[0]=e[0],t[1]=i+o*u-s*l,t[2]=a+o*l+s*u,t}},{}],200:[function(t,e,r){e.exports=function(t,e,r,n){var i=r[0],a=r[2],o=e[0]-i,s=e[2]-a,l=Math.sin(n),u=Math.cos(n);return t[0]=i+s*l+o*u,t[1]=e[1],t[2]=a+s*u-o*l,t}},{}],201:[function(t,e,r){e.exports=function(t,e,r,n){var i=r[0],a=r[1],o=e[0]-i,s=e[1]-a,l=Math.sin(n),u=Math.cos(n);return t[0]=i+o*u-s*l,t[1]=a+o*l+s*u,t[2]=e[2],t}},{}],202:[function(t,e,r){e.exports=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}},{}],203:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}},{}],204:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}},{}],205:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}},{}],206:[function(t,e,r){e.exports=t("./squaredDistance")},{"./squaredDistance":208}],207:[function(t,e,r){e.exports=t("./squaredLength")},{"./squaredLength":209}],208:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}},{}],209:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}},{}],210:[function(t,e,r){e.exports=t("./subtract")},{"./subtract":211}],211:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}},{}],212:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2];return t[0]=n*r[0]+i*r[3]+a*r[6],t[1]=n*r[1]+i*r[4]+a*r[7],t[2]=n*r[2]+i*r[5]+a*r[8],t}},{}],213:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,t}},{}],214:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,f=u*i+l*n-o*a,h=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t}},{}],215:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}},{}],216:[function(t,e,r){e.exports=function(t){var e=new Float32Array(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}},{}],217:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}},{}],218:[function(t,e,r){e.exports=function(){var t=new Float32Array(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}},{}],219:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)}},{}],220:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}},{}],221:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}},{}],222:[function(t,e,r){e.exports=function(t,e,r,n){var i=new Float32Array(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}},{}],223:[function(t,e,r){e.exports={create:t("./create"),clone:t("./clone"),fromValues:t("./fromValues"),copy:t("./copy"),set:t("./set"),add:t("./add"),subtract:t("./subtract"),multiply:t("./multiply"),divide:t("./divide"),min:t("./min"),max:t("./max"),scale:t("./scale"),scaleAndAdd:t("./scaleAndAdd"),distance:t("./distance"),squaredDistance:t("./squaredDistance"),length:t("./length"),squaredLength:t("./squaredLength"),negate:t("./negate"),inverse:t("./inverse"),normalize:t("./normalize"),dot:t("./dot"),lerp:t("./lerp"),random:t("./random"),transformMat4:t("./transformMat4"),transformQuat:t("./transformQuat")}},{"./add":215,"./clone":216,"./copy":217,"./create":218,"./distance":219,"./divide":220,"./dot":221,"./fromValues":222,"./inverse":224,"./length":225,"./lerp":226,"./max":227,"./min":228,"./multiply":229,"./negate":230,"./normalize":231,"./random":232,"./scale":233,"./scaleAndAdd":234,"./set":235,"./squaredDistance":236,"./squaredLength":237,"./subtract":238,"./transformMat4":239,"./transformQuat":240}],224:[function(t,e,r){e.exports=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}},{}],225:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)}},{}],226:[function(t,e,r){e.exports=function(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t}},{}],227:[function(t,e,r){e.exports=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}},{}],228:[function(t,e,r){e.exports=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}},{}],229:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}},{}],230:[function(t,e,r){e.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}},{}],231:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a;o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o);return t}},{}],232:[function(t,e,r){var n=t("./normalize"),i=t("./scale");e.exports=function(t,e){return e=e||1,t[0]=Math.random(),t[1]=Math.random(),t[2]=Math.random(),t[3]=Math.random(),n(t,t),i(t,t,e),t}},{"./normalize":231,"./scale":233}],233:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}},{}],234:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}},{}],235:[function(t,e,r){e.exports=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}},{}],236:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return r*r+n*n+i*i+a*a}},{}],237:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}},{}],238:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}},{}],239:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}},{}],240:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*a-l*i,f=u*i+l*n-o*a,h=u*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=c*u+d*-o+f*-l-h*-s,t[1]=f*u+d*-s+h*-o-c*-l,t[2]=h*u+d*-l+c*-s-f*-o,t[3]=e[3],t}},{}],241:[function(t,e,r){e.exports=function(t,e,r,a){return n[0]=a,n[1]=r,n[2]=e,n[3]=t,i[0]};var n=new Uint8Array(4),i=new Float32Array(n.buffer)},{}],242:[function(t,e,r){var n=t("glsl-tokenizer"),i=t("atob-lite");e.exports=function(t){for(var e=Array.isArray(t)?t:n(t),r=0;r0)continue;r=t.slice(0,1).join("")}return D(r),O+=r.length,(E=E.slice(r.length)).length}}function q(){return/[^a-fA-F0-9]/.test(e)?(D(E.join("")),k=l,M):(E.push(e),r=e,M+1)}function G(){return"."===e?(E.push(e),k=g,r=e,M+1):/[eE]/.test(e)?(E.push(e),k=g,r=e,M+1):"x"===e&&1===E.length&&"0"===E[0]?(k=_,E.push(e),r=e,M+1):/[^\d]/.test(e)?(D(E.join("")),k=l,M):(E.push(e),r=e,M+1)}function X(){return"f"===e&&(E.push(e),r=e,M+=1),/[eE]/.test(e)?(E.push(e),r=e,M+1):"-"===e&&/[eE]/.test(r)?(E.push(e),r=e,M+1):/[^\d]/.test(e)?(D(E.join("")),k=l,M):(E.push(e),r=e,M+1)}function W(){if(/[^\d\w_]/.test(e)){var t=E.join("");return k=N.indexOf(t)>-1?y:I.indexOf(t)>-1?m:v,D(E.join("")),k=l,M}return E.push(e),r=e,M+1}};var n=t("./lib/literals"),i=t("./lib/operators"),a=t("./lib/builtins"),o=t("./lib/literals-300es"),s=t("./lib/builtins-300es"),l=999,u=9999,c=0,f=1,h=2,d=3,p=4,g=5,v=6,m=7,y=8,b=9,x=10,_=11,w=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":245,"./lib/builtins-300es":244,"./lib/literals":247,"./lib/literals-300es":246,"./lib/operators":248}],244:[function(t,e,r){var n=t("./builtins");n=n.slice().filter(function(t){return!/^(gl\_|texture)/.test(t)}),e.exports=n.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":245}],245:[function(t,e,r){e.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]},{}],246:[function(t,e,r){var n=t("./literals");e.exports=n.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":247}],247:[function(t,e,r){e.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},{}],248:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],249:[function(t,e,r){var n=t("./index");e.exports=function(t,e){var r=n(e),i=[];return i=(i=i.concat(r(t))).concat(r(null))}},{"./index":243}],250:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n>1,c=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(e*l-1)*Math.pow(2,i),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],254:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var o=t.slice(0,i+1),s=n.apply(void 0,o);if(0===s)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;c<=i;++c)l[c]=c;s<0&&(l[0]=1,l[1]=0);for(var f=new a(l,new Array(i+1),!1),h=f.adjacent,d=new Array(i+2),c=0;c<=i;++c){for(var p=l.slice(),g=0;g<=i;++g)g===c&&(p[g]=-1);var v=p[0];p[0]=p[1],p[1]=v;var m=new a(p,new Array(i+1),!0);h[c]=m,d[c]=m}d[i+1]=f;for(var c=0;c<=i;++c)for(var p=h[c].vertices,y=h[c].adjacent,g=0;g<=i;++g){var b=p[g];if(b<0)y[g]=f;else for(var x=0;x<=i;++x)h[x].vertices.indexOf(b)<0&&(y[g]=h[x])}for(var _=new u(i,o,d),w=!!e,c=i+1;c0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var i=new Function("test",e.join("")),a=n[t+1];return a||(a=n),i(a)}(t)),this.orient=a}var c=u.prototype;c.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,a=this.vertices,o=[t];for(t.lastVisited=-n;o.length>0;){(t=o.pop()).vertices;for(var s=t.adjacent,l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,f=0;f<=r;++f){var h=c[f];i[f]=h<0?e:a[h]}var d=this.orient();if(d>0)return u;u.lastVisited=-n,0===d&&o.push(u)}}}return null},c.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[o];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(c=0;c<=n;++c){var f=u[c];if(!(f.lastVisited>=r)){var h=a[c];a[c]=t;var d=this.orient();if(a[c]=h,d<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},c.addPeaks=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var h=[];f.length>0;){var d=(e=f.pop()).vertices,p=e.adjacent,g=d.indexOf(r);if(!(g<0))for(var v=0;v<=n;++v)if(v!==g){var m=p[v];if(m.boundary&&!(m.lastVisited>=r)){var y=m.vertices;if(m.lastVisited!==-r){for(var b=0,x=0;x<=n;++x)y[x]<0?(b=x,l[x]=t):l[x]=i[y[x]];if(this.orient()>0){y[b]=r,m.boundary=!1,u.push(m),f.push(m),m.lastVisited=r;continue}m.lastVisited=-r}var _=m.adjacent,w=d.slice(),A=p.slice(),M=new a(w,A,!0);c.push(M);var T=_.indexOf(e);if(!(T<0)){_[T]=M,A[g]=m,w[v]=-1,A[v]=e,p[v]=M,M.flip();for(x=0;x<=n;++x){var k=w[x];if(!(k<0||k===r)){for(var E=new Array(n-1),L=0,S=0;S<=n;++S){var C=w[S];C<0||S===x||(E[L++]=C)}h.push(new o(E,M,x))}}}}}}h.sort(s);for(v=0;v+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":322,"simplicial-complex":332}],255:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),i=0,a=1;function o(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}e.exports=function(t){if(!t||0===t.length)return new b(null);return new b(y(t))};var s=o.prototype;function l(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function u(t,e){var r=y(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function c(t,e){var r=t.intervals([]);r.push(e),u(t,r)}function f(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?i:(r.splice(n,1),u(t,r),a)}function h(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function p(t,e){for(var r=0;r>1],i=[],a=[],s=[];for(r=0;r3*(e+1)?c(this,t):this.left.insert(t):this.left=y([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?c(this,t):this.right.insert(t):this.right=y([t]);else{var r=n.ge(this.leftPoints,t,v),i=n.ge(this.rightPoints,t,m);this.leftPoints.splice(r,0,t),this.rightPoints.splice(i,0,t)}},s.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?f(this,t):2===(u=this.left.remove(t))?(this.left=null,this.count-=1,a):(u===a&&(this.count-=1),u):i;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?f(this,t):2===(u=this.right.remove(t))?(this.right=null,this.count-=1,a):(u===a&&(this.count-=1),u):i;if(1===this.count)return this.leftPoints[0]===t?2:i;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,o=this.left;o.right;)r=o,o=o.right;if(r===this)o.right=this.right;else{var s=this.left,u=this.right;r.count-=o.count,r.right=o.left,o.left=s,o.right=u}l(this,o),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?l(this,this.left):l(this,this.right);return a}for(s=n.ge(this.leftPoints,t,v);sthis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return d(this.rightPoints,t,e)}return p(this.leftPoints,e)},s.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?d(this.rightPoints,t,r):p(this.leftPoints,r)};var x=b.prototype;x.insert=function(t){this.root?this.root.insert(t):this.root=new o(t[0],null,null,[t],[t])},x.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==i}return!1},x.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},x.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(x,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(x,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":35}],256:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}},{}],263:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],264:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1<d[1][2]&&(m[0]=-m[0]),d[0][2]>d[2][0]&&(m[1]=-m[1]),d[1][0]>d[0][1]&&(m[2]=-m[2]),!0}},{"./normalize":266,"gl-mat4/clone":118,"gl-mat4/create":119,"gl-mat4/determinant":120,"gl-mat4/invert":124,"gl-mat4/transpose":135,"gl-vec3/cross":175,"gl-vec3/dot":180,"gl-vec3/length":190,"gl-vec3/normalize":197}],266:[function(t,e,r){e.exports=function(t,e){var r=e[15];if(0===r)return!1;for(var n=1/r,i=0;i<16;i++)t[i]=e[i]*n;return!0}},{}],267:[function(t,e,r){var n=t("gl-vec3/lerp"),i=t("mat4-recompose"),a=t("mat4-decompose"),o=t("gl-mat4/determinant"),s=t("quat-slerp"),l=f(),u=f(),c=f();function f(){return{translate:h(),scale:h(1),skew:h(),perspective:[0,0,0,1],quaternion:[0,0,0,1]}}function h(t){return[t||0,t||0,t||0]}e.exports=function(t,e,r,f){if(0===o(e)||0===o(r))return!1;var h=a(e,l.translate,l.scale,l.skew,l.perspective,l.quaternion),d=a(r,u.translate,u.scale,u.skew,u.perspective,u.quaternion);return!(!h||!d||(n(c.translate,l.translate,u.translate,f),n(c.skew,l.skew,u.skew,f),n(c.scale,l.scale,u.scale,f),n(c.perspective,l.perspective,u.perspective,f),s(c.quaternion,l.quaternion,u.quaternion,f),i(t,c.translate,c.scale,c.skew,c.perspective,c.quaternion),0))}},{"gl-mat4/determinant":120,"gl-vec3/lerp":191,"mat4-decompose":265,"mat4-recompose":268,"quat-slerp":309}],268:[function(t,e,r){var n={identity:t("gl-mat4/identity"),translate:t("gl-mat4/translate"),multiply:t("gl-mat4/multiply"),create:t("gl-mat4/create"),scale:t("gl-mat4/scale"),fromRotationTranslation:t("gl-mat4/fromRotationTranslation")},i=(n.create(),n.create());e.exports=function(t,e,r,a,o,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=o[0],t[7]=o[1],t[11]=o[2],t[15]=o[3],n.identity(i),0!==a[2]&&(i[9]=a[2],n.multiply(t,t,i)),0!==a[1]&&(i[9]=0,i[8]=a[1],n.multiply(t,t,i)),0!==a[0]&&(i[8]=0,i[4]=a[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":119,"gl-mat4/fromRotationTranslation":122,"gl-mat4/identity":123,"gl-mat4/multiply":126,"gl-mat4/scale":133,"gl-mat4/translate":134}],269:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),i=t("mat4-interpolate"),a=t("gl-mat4/invert"),o=t("gl-mat4/rotateX"),s=t("gl-mat4/rotateY"),l=t("gl-mat4/rotateZ"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/translate"),f=(t("gl-mat4/scale"),t("gl-vec3/normalize")),h=[0,0,0];function d(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-1/0,1/0]}e.exports=function(t){return new d((t=t||{}).matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};var p=d.prototype;p.recalcMatrix=function(t){var e=this._time,r=n.le(e,t),o=this.computedMatrix;if(!(r<0)){var s=this._components;if(r===e.length-1)for(var l=16*r,u=0;u<16;++u)o[u]=s[l++];else{var c=e[r+1]-e[r],h=(l=16*r,this.prevMatrix),d=!0;for(u=0;u<16;++u)h[u]=s[l++];var p=this.nextMatrix;for(u=0;u<16;++u)p[u]=s[l++],d=d&&h[u]===p[u];if(c<1e-6||d)for(u=0;u<16;++u)o[u]=h[u];else i(o,h,p,(t-e[r])/c)}var g=this.computedUp;g[0]=o[1],g[1]=o[5],g[2]=o[9],f(g,g);var v=this.computedInverse;a(v,o);var m=this.computedEye,y=v[15];m[0]=v[12]/y,m[1]=v[13]/y,m[2]=v[14]/y;var b=this.computedCenter,x=Math.exp(this.computedRadius[0]);for(u=0;u<3;++u)b[u]=m[u]-o[2+4*u]*x}},p.idle=function(t){if(!(t1&&n(t[o[c-2]],t[o[c-1]],u)<=0;)c-=1,o.pop();for(o.push(l),c=s.length;c>1&&n(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+o.length-2),f=0,i=0,h=o.length;i0;--d)r[f++]=s[d];return r};var n=t("robust-orientation")[3]},{"robust-orientation":322}],271:[function(t,e,r){"use strict";e.exports=function(t,e){e||(e=t,t=window);var r=0,i=0,a=0,o={shift:!1,alt:!1,control:!1,meta:!1},s=!1;function l(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==o.alt,o.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==o.shift,o.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==o.control,o.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==o.meta,o.meta=!!t.metaKey),e}function u(t,s){var u=n.x(s),c=n.y(s);"buttons"in s&&(t=0|s.buttons),(t!==r||u!==i||c!==a||l(s))&&(r=0|t,i=u||0,a=c||0,e&&e(r,i,a,o))}function c(t){u(0,t)}function f(){(r||i||a||o.shift||o.alt||o.meta||o.control)&&(i=a=0,r=0,o.shift=o.alt=o.control=o.meta=!1,e&&e(0,0,0,o))}function h(t){l(t)&&e&&e(r,i,a,o)}function d(t){0===n.buttons(t)?u(0,t):u(r,t)}function p(t){u(r|n.buttons(t),t)}function g(t){u(r&~n.buttons(t),t)}function v(){s||(s=!0,t.addEventListener("mousemove",d),t.addEventListener("mousedown",p),t.addEventListener("mouseup",g),t.addEventListener("mouseleave",c),t.addEventListener("mouseenter",c),t.addEventListener("mouseout",c),t.addEventListener("mouseover",c),t.addEventListener("blur",f),t.addEventListener("keyup",h),t.addEventListener("keydown",h),t.addEventListener("keypress",h),t!==window&&(window.addEventListener("blur",f),window.addEventListener("keyup",h),window.addEventListener("keydown",h),window.addEventListener("keypress",h)))}v();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return s},set:function(e){e?v():s&&(s=!1,t.removeEventListener("mousemove",d),t.removeEventListener("mousedown",p),t.removeEventListener("mouseup",g),t.removeEventListener("mouseleave",c),t.removeEventListener("mouseenter",c),t.removeEventListener("mouseout",c),t.removeEventListener("mouseover",c),t.removeEventListener("blur",f),t.removeEventListener("keyup",h),t.removeEventListener("keydown",h),t.removeEventListener("keypress",h),t!==window&&(window.removeEventListener("blur",f),window.removeEventListener("keyup",h),window.removeEventListener("keydown",h),window.removeEventListener("keypress",h)))},enumerable:!0},buttons:{get:function(){return r},enumerable:!0},x:{get:function(){return i},enumerable:!0},y:{get:function(){return a},enumerable:!0},mods:{get:function(){return o},enumerable:!0}}),m};var n=t("mouse-event")},{"mouse-event":273}],272:[function(t,e,r){var n={left:0,top:0};e.exports=function(t,e,r){e=e||t.currentTarget||t.srcElement,Array.isArray(r)||(r=[0,0]);var i=t.clientX||0,a=t.clientY||0,o=(s=e,s===window||s===document||s===document.body?n:s.getBoundingClientRect());var s;return r[0]=i-o.left,r[1]=a-o.top,r}},{}],273:[function(t,e,r){"use strict";function n(t){return t.target||t.srcElement||window}r.buttons=function(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){if(2===(e=t.which))return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1< 0");"function"!=typeof t.vertex&&e("Must specify vertex creation function");"function"!=typeof t.cell&&e("Must specify cell creation function");"function"!=typeof t.phase&&e("Must specify phase function");for(var L=t.getters||[],S=new Array(k),C=0;C=0?S[C]=!0:S[C]=!1;return function(t,e,r,k,E,L){var S=L.length,C=E.length;if(C<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var O="extractContour"+E.join("_"),R=[],P=[],z=[],I=0;I0&&j.push(l(I,E[N-1])+"*"+s(E[N-1])),P.push(p(I,E[N])+"=("+j.join("-")+")|0")}for(var I=0;I=0;--I)B.push(s(E[I]));P.push(w+"=("+B.join("*")+")|0",x+"=mallocUint32("+w+")",b+"=mallocUint32("+w+")",A+"=0"),P.push(g(0)+"=0");for(var N=1;N<1<0;M=M-1&p)w.push(b+"["+A+"+"+m(M)+"]");w.push(y(0));for(var M=0;M=0;--e)G(e,0);for(var r=[],e=0;e0){",d(E[e]),"=1;");t(e-1,r|1<=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),a.push("1"),o.push("s["+l+"]-2"));var u=".lo("+a.join()+").hi("+o.join()+")";if(0===a.length&&(u=""),i>0){n.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||n.push("&&s[",l,"]>2");n.push("){grad",i,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||n.push(",dst.pick(",s.join(),",",l,")",u);n.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):n.push("if(s[",c,"]>1){diff(",f,",src.pick(",h.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",f,");};");break;case"mirror":0===i?n.push("dst.set(",s.join(),",",c,",0);"):n.push("zero(",f,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[c]="s["+c+"]-2",g[c]="0"):(p[c]="s["+c+"]-1",g[c]="1"),0===i?n.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):n.push("if(s[",c,"]>2){diff(",f,",src.pick(",p.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",f,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}i>0&&n.push("};")}for(var s=0;s<1<>",rrshift:">>>"};!function(){for(var t in s){var e=s[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var l={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var u={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=n({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=n({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=n({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=n({args:["array","array"],pre:i,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":77}],281:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],a=t,o=1;Array.isArray(a);)r.push(a.length),o*=a.length,a=a[0];return 0===r.length?n():(e||(e=n(new Float64Array(o),r)),i(e,t),e)}},{"./doConvert.js":282,ndarray:286}],282:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":77}],283:[function(t,e,r){"use strict";var n=t("typedarray-pool"),i=32;function a(t){switch(t){case"uint8":return[n.mallocUint8,n.freeUint8];case"uint16":return[n.mallocUint16,n.freeUint16];case"uint32":return[n.mallocUint32,n.freeUint32];case"int8":return[n.mallocInt8,n.freeInt8];case"int16":return[n.mallocInt16,n.freeInt16];case"int32":return[n.mallocInt32,n.freeInt32];case"float32":return[n.mallocFloat,n.freeFloat];case"float64":return[n.mallocDouble,n.freeDouble];default:return null}}function o(t){for(var e=[],r=0;r0?s.push(["d",p,"=s",p,"-d",f,"*n",f].join("")):s.push(["d",p,"=s",p].join("")),f=p),0!=(d=t.length-1-l)&&(h>0?s.push(["e",d,"=s",d,"-e",h,"*n",h,",f",d,"=",u[d],"-f",h,"*n",h].join("")):s.push(["e",d,"=s",d,",f",d,"=",u[d]].join("")),h=d)}r.push("var "+s.join(","));var g=["0","n0-1","data","offset"].concat(o(t.length));r.push(["if(n0<=",i,"){","insertionSort(",g.join(","),")}else{","quickSort(",g.join(","),")}"].join("")),r.push("}return "+n);var v=new Function("insertionSort","quickSort",r.join("\n")),m=function(t,e){var r=["'use strict'"],n=["ndarrayInsertionSort",t.join("d"),e].join(""),i=["left","right","data","offset"].concat(o(t.length)),s=a(e),l=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var u=[],c=1;c1){for(r.push("dptr=0;sptr=ptr"),c=t.length-1;c>=0;--c)0!==(d=t[c])&&r.push(["for(i",d,"=0;i",d,"b){break __l}"].join("")),c=t.length-1;c>=1;--c)r.push("sptr+=e"+c,"dptr+=f"+c,"}");for(r.push("dptr=cptr;sptr=cptr-s0"),c=t.length-1;c>=0;--c)0!==(d=t[c])&&r.push(["for(i",d,"=0;i",d,"=0;--c)0!==(d=t[c])&&r.push(["for(i",d,"=0;i",d,"scratch)){",h("cptr",f("cptr-s0")),"cptr-=s0","}",h("cptr","scratch"));return r.push("}"),t.length>1&&s&&r.push("free(scratch)"),r.push("} return "+n),s?new Function("malloc","free",r.join("\n"))(s[0],s[1]):new Function(r.join("\n"))()}(t,e),y=function(t,e,r){var n=["'use strict'"],s=["ndarrayQuickSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(o(t.length)),u=a(e),c=0;n.push(["function ",s,"(",l.join(","),"){"].join(""));var f=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var h=[],d=1;d=0;--a)0!==(o=t[a])&&n.push(["for(i",o,"=0;i",o,"1)for(a=0;a1?n.push("ptr_shift+=d"+o):n.push("ptr0+=d"+o),n.push("}"))}}function y(e,r,i,a){if(1===r.length)n.push("ptr0="+p(r[0]));else{for(var o=0;o1)for(o=0;o=1;--o)i&&n.push("pivot_ptr+=f"+o),r.length>1?n.push("ptr_shift+=e"+o):n.push("ptr0+=e"+o),n.push("}")}function b(){t.length>1&&u&&n.push("free(pivot1)","free(pivot2)")}function x(e,r){var i="el"+e,a="el"+r;if(t.length>1){var o="__l"+ ++c;y(o,[i,a],!1,["comp=",g("ptr0"),"-",g("ptr1"),"\n","if(comp>0){tmp0=",i,";",i,"=",a,";",a,"=tmp0;break ",o,"}\n","if(comp<0){break ",o,"}"].join(""))}else n.push(["if(",g(p(i)),">",g(p(a)),"){tmp0=",i,";",i,"=",a,";",a,"=tmp0}"].join(""))}function _(e,r){t.length>1?m([e,r],!1,v("ptr0",g("ptr1"))):n.push(v(p(e),g(p(r))))}function w(e,r,i){if(t.length>1){var a="__l"+ ++c;y(a,[r],!0,[e,"=",g("ptr0"),"-pivot",i,"[pivot_ptr]\n","if(",e,"!==0){break ",a,"}"].join(""))}else n.push([e,"=",g(p(r)),"-pivot",i].join(""))}function A(e,r){t.length>1?m([e,r],!1,["tmp=",g("ptr0"),"\n",v("ptr0",g("ptr1")),"\n",v("ptr1","tmp")].join("")):n.push(["ptr0=",p(e),"\n","ptr1=",p(r),"\n","tmp=",g("ptr0"),"\n",v("ptr0",g("ptr1")),"\n",v("ptr1","tmp")].join(""))}function M(e,r,i){t.length>1?(m([e,r,i],!1,["tmp=",g("ptr0"),"\n",v("ptr0",g("ptr1")),"\n",v("ptr1",g("ptr2")),"\n",v("ptr2","tmp")].join("")),n.push("++"+r,"--"+i)):n.push(["ptr0=",p(e),"\n","ptr1=",p(r),"\n","ptr2=",p(i),"\n","++",r,"\n","--",i,"\n","tmp=",g("ptr0"),"\n",v("ptr0",g("ptr1")),"\n",v("ptr1",g("ptr2")),"\n",v("ptr2","tmp")].join(""))}function T(t,e){A(t,e),n.push("--"+e)}function k(e,r,i){t.length>1?m([e,r],!0,[v("ptr0",g("ptr1")),"\n",v("ptr1",["pivot",i,"[pivot_ptr]"].join(""))].join("")):n.push(v(p(e),g(p(r))),v(p(r),"pivot"+i))}function E(e,r){n.push(["if((",r,"-",e,")<=",i,"){\n","insertionSort(",e,",",r,",data,offset,",o(t.length).join(","),")\n","}else{\n",s,"(",e,",",r,",data,offset,",o(t.length).join(","),")\n","}"].join(""))}function L(e,r,i){t.length>1?(n.push(["__l",++c,":while(true){"].join("")),m([e],!0,["if(",g("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",c,"}"].join("")),n.push(i,"}")):n.push(["while(",g(p(e)),"===pivot",r,"){",i,"}"].join(""))}return n.push("var "+f.join(",")),x(1,2),x(4,5),x(1,3),x(2,3),x(1,4),x(3,4),x(2,5),x(2,3),x(4,5),t.length>1?m(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",g("ptr1"),"\n","pivot2[pivot_ptr]=",g("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",g("ptr0"),"\n","y=",g("ptr2"),"\n","z=",g("ptr4"),"\n",v("ptr5","x"),"\n",v("ptr6","y"),"\n",v("ptr7","z")].join("")):n.push(["pivot1=",g(p("el2")),"\n","pivot2=",g(p("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",g(p("el1")),"\n","y=",g(p("el3")),"\n","z=",g(p("el5")),"\n",v(p("index1"),"x"),"\n",v(p("index3"),"y"),"\n",v(p("index5"),"z")].join("")),_("index2","left"),_("index4","right"),n.push("if(pivots_are_equal){"),n.push("for(k=less;k<=great;++k){"),w("comp","k",1),n.push("if(comp===0){continue}"),n.push("if(comp<0){"),n.push("if(k!==less){"),A("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),n.push("while(true){"),w("comp","great",1),n.push("if(comp>0){"),n.push("great--"),n.push("}else if(comp<0){"),M("k","less","great"),n.push("break"),n.push("}else{"),T("k","great"),n.push("break"),n.push("}"),n.push("}"),n.push("}"),n.push("}"),n.push("}else{"),n.push("for(k=less;k<=great;++k){"),w("comp_pivot1","k",1),n.push("if(comp_pivot1<0){"),n.push("if(k!==less){"),A("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),w("comp_pivot2","k",2),n.push("if(comp_pivot2>0){"),n.push("while(true){"),w("comp","great",2),n.push("if(comp>0){"),n.push("if(--greatindex5){"),L("less",1,"++less"),L("great",2,"--great"),n.push("for(k=less;k<=great;++k){"),w("comp_pivot1","k",1),n.push("if(comp_pivot1===0){"),n.push("if(k!==less){"),A("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),w("comp_pivot2","k",2),n.push("if(comp_pivot2===0){"),n.push("while(true){"),w("comp","great",2),n.push("if(comp===0){"),n.push("if(--great1&&u?new Function("insertionSort","malloc","free",n.join("\n"))(r,u[0],u[1]):new Function("insertionSort",n.join("\n"))(r)}(t,e,m);return v(m,y)}},{"typedarray-pool":348}],284:[function(t,e,r){"use strict";var n=t("./lib/compile_sort.js"),i={};e.exports=function(t){var e=t.order,r=t.dtype,a=[e,r].join(":"),o=i[a];return o||(i[a]=o=n(e,r)),o(t),t}},{"./lib/compile_sort.js":283}],285:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate"),i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_39_arg4_)}",args:[{name:"_inline_39_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_39_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_39_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_39_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_39_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_40_arg2_(this_warped,_inline_40_arg0_),_inline_40_arg1_=_inline_40_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_40_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_40_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_40_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),a=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_43_arg2_(this_warped,_inline_43_arg0_),_inline_43_arg1_=_inline_43_arg3_(_inline_43_arg4_,this_warped[0])}",args:[{name:"_inline_43_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_43_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_43_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),o=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_46_arg2_(this_warped,_inline_46_arg0_),_inline_46_arg1_=_inline_46_arg3_(_inline_46_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_46_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_46_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp2D",blockSize:64}),s=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_49_arg2_(this_warped,_inline_49_arg0_),_inline_49_arg1_=_inline_49_arg3_(_inline_49_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_49_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_49_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_49_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_49_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_49_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:a(t,r,n.d1,e);break;case 2:o(t,r,n.d2,e);break;case 3:s(t,r,n.d3,e);break;default:i(t,r,n.bind(void 0,e),e.shape.length)}return t}},{"cwise/lib/wrapper":80,"ndarray-linear-interpolate":279}],286:[function(t,e,r){var n=t("iota-array"),i=t("is-buffer"),a="undefined"!=typeof Float64Array;function o(t,e){return t[0]-e[0]}function s(){var t,e=this.stride,r=new Array(e.length);for(t=0;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+r+"_set("+l.join(",")+",v){"),i?a.push("return this.data.set("+c+",v)}"):a.push("return this.data["+c+"]=v}"),a.push("proto.get=function "+r+"_get("+l.join(",")+"){"),i?a.push("return this.data.get("+c+")}"):a.push("return this.data["+c+"]}"),a.push("proto.index=function "+r+"_index(",l.join(),"){return "+c+"}"),a.push("proto.hi=function "+r+"_hi("+l.join(",")+"){return new "+r+"(this.data,"+o.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+o.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var d=o.map(function(t){return"a"+t+"=this.shape["+t+"]"}),p=o.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+l.join(",")+"){var b=this.offset,d=0,"+d.join(",")+","+p.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");a.push("return new "+r+"(this.data,"+o.map(function(t){return"a"+t}).join(",")+","+o.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+l.join(",")+"){var "+o.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+o.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(g=0;g=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+o.map(function(t){return"shape["+t+"]"}).join(",")+","+o.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(u[t],s)}var u={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=function(t,e,r,n){if(void 0===t)return(0,u.array[0])([]);"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var o=e.length;if(void 0===r){r=new Array(o);for(var s=o-1,c=1;s>=0;--s)r[s]=c,c*=e[s]}if(void 0===n)for(n=0,s=0;s>>0;e.exports=function(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return e<0?-i:i;var r=n.hi(t),o=n.lo(t);e>t==t>0?o===a?(r+=1,o=0):o+=1:0===o?(o=a,r-=1):o-=1;return n.pack(o,r)}},{"double-bits":84}],288:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa){var x=i[u],_=1/Math.sqrt(v*y);for(b=0;b<3;++b){var w=(b+1)%3,A=(b+2)%3;x[b]+=_*(m[w]*g[A]-m[A]*g[w])}}}for(o=0;oa)for(_=1/Math.sqrt(M),b=0;b<3;++b)x[b]*=_;else for(b=0;b<3;++b)x[b]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(d):0;for(u=0;u<3;++u)h[u]*=d;i[o]=h}return i}},{}],289:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(f>0){var f=Math.sqrt(c+1);t[0]=.5*(o-l)/f,t[1]=.5*(s-n)/f,t[2]=.5*(r-a)/f,t[3]=.5*f}else{var h=Math.max(e,a,u),f=Math.sqrt(2*h-c+1);e>=h?(t[0]=.5*f,t[1]=.5*(i+r)/f,t[2]=.5*(s+n)/f,t[3]=.5*(o-l)/f):a>=h?(t[0]=.5*(r+i)/f,t[1]=.5*f,t[2]=.5*(l+o)/f,t[3]=.5*(s-n)/f):(t[0]=.5*(n+s)/f,t[1]=.5*(o+l)/f,t[2]=.5*f,t[3]=.5*(r-i)/f)}return t}},{}],290:[function(t,e,r){"use strict";e.exports=function(t){var e=(t=t||{}).center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),c(r=[].slice.call(r,0,4),r);var i=new f(r,e,Math.log(n));i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up);return i};var n=t("filtered-vector"),i=t("gl-mat4/lookAt"),a=t("gl-mat4/fromQuat"),o=t("gl-mat4/invert"),s=t("./lib/quatFromFrame");function l(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function u(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function c(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=u(r,n,i,a);o>1e-6?(t[0]=r/o,t[1]=n/o,t[2]=i/o,t[3]=a/o):(t[0]=t[1]=t[2]=0,t[3]=1)}function f(t,e,r){this.radius=n([r]),this.center=n(e),this.rotation=n(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}var h=f.prototype;h.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},h.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;c(e,e);var r=this.computedMatrix;a(r,e);var n=this.computedCenter,i=this.computedEye,o=this.computedUp,s=Math.exp(this.computedRadius[0]);i[0]=n[0]+s*r[2],i[1]=n[1]+s*r[6],i[2]=n[2]+s*r[10],o[0]=r[1],o[1]=r[5],o[2]=r[9];for(var l=0;l<3;++l){for(var u=0,f=0;f<3;++f)u+=r[l+4*f]*i[f];r[12+l]=-u}},h.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r},h.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},h.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},h.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=i[1],o=i[5],s=i[9],u=l(a,o,s);a/=u,o/=u,s/=u;var c=i[0],f=i[4],h=i[8],d=c*a+f*o+h*s,p=l(c-=a*d,f-=o*d,h-=s*d);c/=p,f/=p,h/=p;var g=i[2],v=i[6],m=i[10],y=g*a+v*o+m*s,b=g*c+v*f+m*h,x=l(g-=y*a+b*c,v-=y*o+b*f,m-=y*s+b*h);g/=x,v/=x,m/=x;var _=c*e+a*r,w=f*e+o*r,A=h*e+s*r;this.center.move(t,_,w,A);var M=Math.exp(this.computedRadius[0]);M=Math.max(1e-4,M+n),this.radius.set(t,Math.log(M))},h.rotate=function(t,e,r,n){this.recalcMatrix(t),e=e||0,r=r||0;var i=this.computedMatrix,a=i[0],o=i[4],s=i[8],c=i[1],f=i[5],h=i[9],d=i[2],p=i[6],g=i[10],v=e*a+r*c,m=e*o+r*f,y=e*s+r*h,b=-(p*y-g*m),x=-(g*v-d*y),_=-(d*m-p*v),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),A=u(b,x,_,w);A>1e-6?(b/=A,x/=A,_/=A,w/=A):(b=x=_=0,w=1);var M=this.computedRotation,T=M[0],k=M[1],E=M[2],L=M[3],S=T*w+L*b+k*_-E*x,C=k*w+L*x+E*b-T*_,O=E*w+L*_+T*x-k*b,R=L*w-T*b-k*x-E*_;if(n){b=d,x=p,_=g;var P=Math.sin(n)/l(b,x,_);b*=P,x*=P,_*=P,R=R*(w=Math.cos(e))-(S=S*w+R*b+C*_-O*x)*b-(C=C*w+R*x+O*b-S*_)*x-(O=O*w+R*_+S*x-C*b)*_}var z=u(S,C,O,R);z>1e-6?(S/=z,C/=z,O/=z,R/=z):(S=C=O=0,R=1),this.rotation.set(t,S,C,O,R)},h.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var a=this.computedMatrix;i(a,e,r,n);var o=this.computedRotation;s(o,a[0],a[1],a[2],a[4],a[5],a[6],a[8],a[9],a[10]),c(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var l=0,u=0;u<3;++u)l+=Math.pow(r[u]-e[u],2);this.radius.set(t,.5*Math.log(Math.max(l,1e-6))),this.center.set(t,r[0],r[1],r[2])},h.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},h.setMatrix=function(t,e){var r=this.computedRotation;s(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),c(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;o(n,e);var i=n[15];if(Math.abs(i)>1e-6){var a=n[12]/i,l=n[13]/i,u=n[14]/i;this.recalcMatrix(t);var f=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*f,l-n[6]*f,u-n[10]*f),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},h.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},h.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-1/0,e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},h.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},h.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},h.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":289,"filtered-vector":91,"gl-mat4/fromQuat":121,"gl-mat4/invert":124,"gl-mat4/lookAt":125}],291:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return n(r="undefined"!=typeof r?r+"":" ",e)+t}},{"repeat-string":315}],292:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],293:[function(t,e,r){"use strict";e.exports=function(t){var e=t.length;if(e0;--o)a=l[o],r=s[o],s[o]=s[a],s[a]=r,l[o]=l[r],l[r]=a,u=(u+r)*o;return n.freeUint32(l),n.freeUint32(s),u},r.unrank=function(t,e,r){switch(t){case 0:return r||[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}var n,i,a,o=1;for((r=r||new Array(t))[0]=0,a=1;a0;--a)e=e-(n=e/o|0)*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}},{"invert-permutation":256,"typedarray-pool":348}],295:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=0|e.length,i=t.length,a=[new Array(r),new Array(r)],o=0;o0){o=a[c][r][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=a[f][r],d=0;d0&&(o=p,s=g,l=f)}return i?s:(o&&u(o,l),s)}function f(t,r){var i=a[r][t][0],o=[t];u(i,r);for(var s=i[1^r];;){for(;s!==t;)o.push(s),s=c(o[o.length-2],s,!1);if(a[0][t].length+a[1][t].length===0)break;var l=o[o.length-1],f=t,h=o[1],d=c(l,f,!0);if(n(e[l],e[f],e[h],e[d])<0)break;o.push(t),s=c(l,f)}return o}function h(t,e){return e[1]===e[e.length-1]}for(var o=0;o0;){a[0][o].length;var g=f(o,d);h(p,g)?p.push.apply(p,g):(p.length>0&&l.push(p),p=g)}p.length>0&&l.push(p)}return l};var n=t("compare-angle")},{"compare-angle":69}],296:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=n(t,e.length),i=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var u=o.pop();i[u]=!1;for(var c=r[u],s=0;s0})).length,v=new Array(g),m=new Array(g),d=0;d0;){var j=D.pop(),B=S[j];l(B,function(t,e){return t-e});var U,V=B.length,H=F[j];if(0===H){var A=p[j];U=[A]}for(var d=0;d=0)&&(F[q]=1^H,D.push(q),0===H)){var A=p[q];N(A)||(A.reverse(),U.push(A))}}0===H&&r.push(U)}return r};var n=t("edges-to-adjacency-list"),i=t("planar-dual"),a=t("point-in-big-polygon"),o=t("two-product"),s=t("robust-sum"),l=t("uniq"),u=t("./lib/trim-leaves");function c(t,e){for(var r=new Array(t),n=0;n0&&e[i]===r[0]))return 1;a=t[i-1]}for(var s=1;a;){var l=a.key,u=n(r,l[0],l[1]);if(l[0][0]0))return 0;s=-1,a=a.right}else if(u>0)a=a.left;else{if(!(u<0))return 0;s=1,a=a.right}}return s}}(m.slabs,m.coordinates);return 0===a.length?y:function(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}(l(a),y)};var n=t("robust-orientation")[3],i=t("slab-decomposition"),a=t("interval-tree-1d"),o=t("binary-search-bounds");function s(){return!0}function l(t){for(var e={},r=0;r=-t},pointBetween:function(e,r,n){var i=e[1]-r[1],a=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*a+i*s;return!(l-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-i>t&&(a-u)*(i-c)/(o-c)+u-n>t&&(s=!s),a=u,o=c}return s}};return e}},{}],302:[function(t,e,r){var n={toPolygon:function(t,e){function r(e){if(e.length<=0)return t.segments({inverted:!1,regions:[]});function r(e){var r=e.slice(0,e.length-1);return t.segments({inverted:!1,regions:[r]})}for(var n=r(e[0]),i=1;i0})}function c(t,n){var i=t.seg,a=n.seg,o=i.start,s=i.end,u=a.start,c=a.end;r&&r.checkIntersection(i,a);var f=e.linesIntersect(o,s,u,c);if(!1===f){if(!e.pointsCollinear(o,s,u))return!1;if(e.pointsSame(o,c)||e.pointsSame(s,u))return!1;var h=e.pointsSame(o,u),d=e.pointsSame(s,c);if(h&&d)return n;var p=!h&&e.pointBetween(o,u,c),g=!d&&e.pointBetween(s,u,c);if(h)return g?l(n,s):l(t,c),n;p&&(d||(g?l(n,s):l(t,c)),l(n,o))}else 0===f.alongA&&(-1===f.alongB?l(t,u):0===f.alongB?l(t,f.pt):1===f.alongB&&l(t,c)),0===f.alongB&&(-1===f.alongA?l(n,o):0===f.alongA?l(n,f.pt):1===f.alongA&&l(n,s));return!1}for(var f=[];!a.isEmpty();){var h=a.getHead();if(r&&r.vert(h.pt[0]),h.isStart){r&&r.segmentNew(h.seg,h.primary);var d=u(h),p=d.before?d.before.ev:null,g=d.after?d.after.ev:null;function v(){if(p){var t=c(h,p);if(t)return t}return!!g&&c(h,g)}r&&r.tempStatus(h.seg,!!p&&p.seg,!!g&&g.seg);var m,y,b=v();if(b)t?(y=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(b.seg.myFill.above=!b.seg.myFill.above):b.seg.otherFill=h.seg.myFill,r&&r.segmentUpdate(b.seg),h.other.remove(),h.remove();if(a.getHead()!==h){r&&r.rewind(h.seg);continue}t?(y=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below,h.seg.myFill.below=g?g.seg.myFill.above:i,h.seg.myFill.above=y?!h.seg.myFill.below:h.seg.myFill.below):null===h.seg.otherFill&&(m=g?h.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:h.primary?o:i,h.seg.otherFill={above:m,below:m}),r&&r.status(h.seg,!!p&&p.seg,!!g&&g.seg),h.other.status=d.insert(n.node({ev:h}))}else{var x=h.status;if(null===x)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(s.exists(x.prev)&&s.exists(x.next)&&c(x.prev.ev,x.next.ev),r&&r.statusRemove(x.ev.seg),x.remove(),!h.primary){var _=h.seg.myFill;h.seg.myFill=h.seg.otherFill,h.seg.otherFill=_}f.push(h.seg)}a.getHead().remove()}return r&&r.done(),f}return t?{addRegion:function(t){for(var n,i,a,o=t[t.length-1],l=0;l=u?(M=1,y=u+2*h+p):y=h*(M=-h/u)+p):(M=0,d>=0?(T=0,y=p):-d>=f?(T=1,y=f+2*d+p):y=d*(T=-d/f)+p);else if(T<0)T=0,h>=0?(M=0,y=p):-h>=u?(M=1,y=u+2*h+p):y=h*(M=-h/u)+p;else{var k=1/A;y=(M*=k)*(u*M+c*(T*=k)+2*h)+T*(c*M+f*T+2*d)+p}else M<0?(x=f+d)>(b=c+h)?(_=x-b)>=(w=u-2*c+f)?(M=1,T=0,y=u+2*h+p):y=(M=_/w)*(u*M+c*(T=1-M)+2*h)+T*(c*M+f*T+2*d)+p:(M=0,x<=0?(T=1,y=f+2*d+p):d>=0?(T=0,y=p):y=d*(T=-d/f)+p):T<0?(x=u+h)>(b=c+d)?(_=x-b)>=(w=u-2*c+f)?(T=1,M=0,y=f+2*d+p):y=(M=1-(T=_/w))*(u*M+c*T+2*h)+T*(c*M+f*T+2*d)+p:(T=0,x<=0?(M=1,y=u+2*h+p):h>=0?(M=0,y=p):y=h*(M=-h/u)+p):(_=f+d-c-h)<=0?(M=0,T=1,y=f+2*d+p):_>=(w=u-2*c+f)?(M=1,T=0,y=u+2*h+p):y=(M=_/w)*(u*M+c*(T=1-M)+2*h)+T*(c*M+f*T+2*d)+p;var E=1-M-T;for(l=0;l1)for(var r=1;r0){var u=t[r-1];if(0===n(s,u)&&a(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}},{"cell-orientation":55,"compare-cell":70,"compare-oriented-cell":71}],315:[function(t,e,r){"use strict";var n,i="";e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("expected a string");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;if(n!==t||"undefined"==typeof n)n=t,i="";else if(i.length>=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i=(i+=t).substr(0,r)}},{}],316:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],317:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i],s=(r=a+o)-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",t(e.slice(0,r)),",",t(e.slice(r)),")"].join("")}(e);var n}function c(t){return new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",u(function(t){for(var e=new Array(t),r=0;r>1;return["sum(",u(t.slice(0,e)),",",u(t.slice(e)),")"].join("")}function c(t,e){if("m"===t.charAt(0)){if("w"===e.charAt(0)){var r=t.split("[");return["w",e.substr(1),"m",r[0].substr(1)].join("")}return["prod(",t,",",e,")"].join("")}return c(e,t)}function f(t){if(2===t.length)return[["diff(",c(t[0][0],t[1][1]),",",c(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var o=0;o0&&r.push(","),o===i?r.push("+b[",a,"]"):r.push("+A[",a,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var s=new Function("det",r.join(""));return s(t<6?n[t]:n)}var o=[function(){return[0]},function(t,e){return[[e[0]],[t[0][0]]]}];!function(){for(;o.length>1;return["sum(",u(t.slice(0,e)),",",u(t.slice(e)),")"].join("")}function c(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;r0){if(a<=0)return o;n=i+a}else{if(!(i<0))return o;if(a>=0)return o;n=-(i+a)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:h(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],a=e[0]-n[0],o=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],u=r[1]-n[1],c=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],p=a*u,g=o*l,v=o*s,m=i*u,y=i*l,b=a*s,x=c*(p-g)+f*(v-m)+h*(y-b),_=7.771561172376103e-16*((Math.abs(p)+Math.abs(g))*Math.abs(c)+(Math.abs(v)+Math.abs(m))*Math.abs(f)+(Math.abs(y)+Math.abs(b))*Math.abs(h));return x>_||-x>_?x:d(t,e,r,n)}];!function(){for(;p.length<=s;)p.push(f(p.length));for(var t=[],r=["slow"],n=0;n<=s;++n)t.push("a"+n),r.push("o"+n);var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(n=2;n<=s;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i0&&o>0||a<0&&o<0)return!1;var s=n(r,t,e),l=n(i,t,e);if(s>0&&l>0||s<0&&l<0)return!1;if(0===a&&0===o&&0===s&&0===l)return function(t,e,r,n){for(var i=0;i<2;++i){var a=t[i],o=e[i],s=Math.min(a,o),l=Math.max(a,o),u=r[i],c=n[i],f=Math.min(u,c),h=Math.max(u,c);if(h=n?(i=f,(l+=1)=n?(i=f,(l+=1)0?1:0}},{}],329:[function(t,e,r){"use strict";e.exports=function(t){return i(n(t))};var n=t("boundary-cells"),i=t("reduce-simplicial-complex")},{"boundary-cells":38,"reduce-simplicial-complex":314}],330:[function(t,e,r){"use strict";e.exports=function(t,e,r,s){r=r||0,"undefined"==typeof s&&(s=function(t){for(var e=t.length,r=0,n=0;n>1,v=E[2*m+1];","if(v===b){return m}","if(b0&&l.push(","),l.push("[");for(var n=0;n0&&l.push(","),l.push("B(C,E,c[",i[0],"],c[",i[1],"])")}l.push("]")}l.push(");")}}for(var a=t+1;a>1;--a){a>1,s=a(t[o],e);s<=0?(0===s&&(i=o),r=o+1):s>0&&(n=o-1)}return i}function c(t,e){for(var r=new Array(t.length),i=0,o=r.length;i=t.length||0!==a(t[v],s)););}return r}function f(t,e){if(e<0)return[];for(var r=[],i=(1<>>c&1&&u.push(i[c]);e.push(u)}return s(e)},r.skeleton=f,r.boundary=function(t){for(var e=[],r=0,n=t.length;r>1:(t>>1)-1}function b(t){for(var e=m(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(n0;){var r=y(t);if(r>=0){var n=m(r);if(e0){var t=M[0];return v(0,E-1),E-=1,b(0),t}return-1}function w(t,e){var r=M[t];return u[r]===e?t:(u[r]=-1/0,x(t),_(),u[r]=e,x((E+=1)-1))}function A(t){if(!c[t]){c[t]=!0;var e=s[t],r=l[t];s[r]>=0&&(s[r]=e),l[e]>=0&&(l[e]=r),T[e]>=0&&w(T[e],g(e)),T[r]>=0&&w(T[r],g(r))}}for(var M=[],T=new Array(a),f=0;f>1;f>=0;--f)b(f);for(;;){var L=_();if(L<0||u[L]>r)break;A(L)}for(var S=[],f=0;f=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&O.push([n,i])}}),i.unique(i.normalize(O)),{positions:S,edges:O}};var n=t("robust-orientation"),i=t("simplicial-complex")},{"robust-orientation":322,"simplicial-complex":334}],337:[function(t,e,r){"use strict";e.exports=function(t,e){var r,a,o,s;if(e[0][0]e[1][0]))return i(e,t);r=e[1],a=e[0]}if(t[0][0]t[1][0]))return-i(t,e);o=t[1],s=t[0]}var l=n(r,a,s),u=n(r,a,o);if(l<0){if(u<=0)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=n(s,o,a),u=n(s,o,r),l<0){if(u<=0)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return a[0]-s[0]};var n=t("robust-orientation");function i(t,e){var r,i,a,o;if(e[0][0]e[1][0])){var s=Math.min(t[0][1],t[1][1]),l=Math.max(t[0][1],t[1][1]),u=Math.min(e[0][1],e[1][1]),c=Math.max(e[0][1],e[1][1]);return lc?s-c:l-c}r=e[1],i=e[0]}t[0][1]0)if(e[0]!==o[1][0])r=t,t=t.right;else{if(l=u(t.right,e))return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l;if(l=u(t.right,e))return l;t=t.left}}return r}function c(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function f(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}s.prototype.castUp=function(t){var e=n.le(this.coordinates,t[0]);if(e<0)return-1;this.slabs[e];var r=u(this.slabs[e],t),i=-1;if(r&&(i=r.value),this.coordinates[e]===t[0]){var s=null;if(r&&(s=r.key),e>0){var c=u(this.slabs[e-1],t);c&&(s?o(c.key,s)>0&&(s=c.key,i=c.value):(i=c.value,s=c.key))}var f=this.horizontal[e];if(f.length>0){var h=n.ge(f,t[1],l);if(h=f.length)return i;d=f[h]}}if(d.start)if(s){var p=a(s[0],s[1],[t[0],d.y]);s[0][0]>s[1][0]&&(p=-p),p>0&&(i=d.index)}else i=d.index;else d.y!==t[1]&&(i=d.index)}}}return i}},{"./lib/order-segments":337,"binary-search-bounds":35,"functional-red-black-tree":92,"robust-orientation":322}],339:[function(t,e,r){"use strict";var n=t("robust-dot-product"),i=t("robust-sum");function a(t,e){var r=i(n(t,e),[e[e.length-1]]);return r[r.length-1]}function o(t,e,r,n){var i=-e/(n-e);i<0?i=0:i>1&&(i=1);for(var a=1-i,o=t.length,s=new Array(o),l=0;l0||i>0&&c<0){var f=o(s,c,l,i);r.push(f),n.push(f.slice())}c<0?n.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),n.push(l.slice())),i=c}return{positive:r,negative:n}},e.exports.positive=function(t,e){for(var r=[],n=a(t[t.length-1],e),i=t[t.length-1],s=t[0],l=0;l0||n>0&&u<0)&&r.push(o(i,u,s,n)),u>=0&&r.push(s.slice()),n=u}return r},e.exports.negative=function(t,e){for(var r=[],n=a(t[t.length-1],e),i=t[t.length-1],s=t[0],l=0;l0||n>0&&u<0)&&r.push(o(i,u,s,n)),u<=0&&r.push(s.slice()),n=u}return r}},{"robust-dot-product":319,"robust-sum":327}],340:[function(t,e,r){!function(){"use strict";var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function e(r){return function(r,n){var i,a,o,s,l,u,c,f,h,d=1,p=r.length,g="";for(a=0;a=0),s.type){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,s.width?parseInt(s.width):0);break;case"e":i=s.precision?parseFloat(i).toExponential(s.precision):parseFloat(i).toExponential();break;case"f":i=s.precision?parseFloat(i).toFixed(s.precision):parseFloat(i);break;case"g":i=s.precision?String(Number(i.toPrecision(s.precision))):parseFloat(i);break;case"o":i=(parseInt(i,10)>>>0).toString(8);break;case"s":i=String(i),i=s.precision?i.substring(0,s.precision):i;break;case"t":i=String(!!i),i=s.precision?i.substring(0,s.precision):i;break;case"T":i=Object.prototype.toString.call(i).slice(8,-1).toLowerCase(),i=s.precision?i.substring(0,s.precision):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=s.precision?i.substring(0,s.precision):i;break;case"x":i=(parseInt(i,10)>>>0).toString(16);break;case"X":i=(parseInt(i,10)>>>0).toString(16).toUpperCase()}t.json.test(s.type)?g+=i:(!t.number.test(s.type)||f&&!s.sign?h="":(h=f?"+":"-",i=i.toString().replace(t.sign,"")),u=s.pad_char?"0"===s.pad_char?"0":s.pad_char.charAt(1):" ",c=s.width-(h+i).length,l=s.width&&c>0?u.repeat(c):"",g+=s.align?h+i+l:"0"===u?h+l+i:l+h+i)}return g}(function(e){if(i[e])return i[e];var r,n=e,a=[],o=0;for(;n;){if(null!==(r=t.text.exec(n)))a.push(r[0]);else if(null!==(r=t.modulo.exec(n)))a.push("%");else{if(null===(r=t.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){o|=1;var s=[],l=r[2],u=[];if(null===(u=t.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=t.key_access.exec(l)))s.push(u[1]);else{if(null===(u=t.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(u[1])}r[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");a.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}n=n.substring(r[0].length)}return i[e]=a}(r),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}var i=Object.create(null);"undefined"!=typeof r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],341:[function(t,e,r){"use strict";e.exports=function(t,e){if(t.dimension<=0)return{positions:[],cells:[]};if(1===t.dimension)return function(t,e){for(var r=a(t,e),n=r.length,i=new Array(n),o=new Array(n),s=0;s c)|0 },"),"generic"===e&&a.push("getters:[0],");for(var s=[],l=[],u=0;u>>7){");for(var u=0;u<1<<(1<128&&u%128==0){f.length>0&&h.push("}}");var d="vExtra"+f.length;a.push("case ",u>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&u,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(T="+"+v[x]+"*c");var k=p[x].length/y*.5,E=.5+m[x]/y*.5;M.push("d"+x+"-"+E+"-"+k+"*("+p[x].join("+")+T+")/("+g[x].join("+")+")")}h.push("a.push([",M.join(),"]);","break;")}a.push("}},"),f.length>0&&h.push("}}");for(var L=[],u=0;u<1<1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=C(t,360),e=C(e,100),r=C(r,100),0===e)n=i=a=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;n=o(l,s,t+1/3),i=o(l,s,t),a=o(l,s,t-1/3)}return{r:255*n,g:255*i,b:255*a}}(e.h,l,c),f=!0,h="hsl"),e.hasOwnProperty("a")&&(a=e.a));var d,p,g;return a=S(a),{ok:f,format:e.format||h,r:o(255,s(i.r,0)),g:o(255,s(i.g,0)),b:o(255,s(i.b,0)),a:a}}(e);this._originalInput=e,this._r=c.r,this._g=c.g,this._b=c.b,this._a=c.a,this._roundA=a(100*this._a)/100,this._format=l.format||c.format,this._gradientType=l.gradientType,this._r<1&&(this._r=a(this._r)),this._g<1&&(this._g=a(this._g)),this._b<1&&(this._b=a(this._b)),this._ok=c.ok,this._tc_id=i++}function c(t,e,r){t=C(t,255),e=C(e,255),r=C(r,255);var n,i,a=s(t,e,r),l=o(t,e,r),u=(a+l)/2;if(a==l)n=i=0;else{var c=a-l;switch(i=u>.5?c/(2-a-l):c/(a+l),a){case t:n=(e-r)/c+(e>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(u(n));return a}function k(t,e){e=e||6;for(var r=u(t).toHsv(),n=r.h,i=r.s,a=r.v,o=[],s=1/e;e--;)o.push(u({h:n,s:i,v:a})),a=(a+s)%1;return o}u.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var e,r,n,i=this.toRgb();return e=i.r/255,r=i.g/255,n=i.b/255,.2126*(e<=.03928?e/12.92:t.pow((e+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:t.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:t.pow((n+.055)/1.055,2.4))},setAlpha:function(t){return this._a=S(t),this._roundA=a(100*this._a)/100,this},toHsv:function(){var t=f(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=f(this._r,this._g,this._b),e=a(360*t.h),r=a(100*t.s),n=a(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=c(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=c(this._r,this._g,this._b),e=a(360*t.h),r=a(100*t.s),n=a(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return h(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,n,i){var o=[P(a(t).toString(16)),P(a(e).toString(16)),P(a(r).toString(16)),P(I(n))];if(i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:a(this._r),g:a(this._g),b:a(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+a(this._r)+", "+a(this._g)+", "+a(this._b)+")":"rgba("+a(this._r)+", "+a(this._g)+", "+a(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:a(100*C(this._r,255))+"%",g:a(100*C(this._g,255))+"%",b:a(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*C(this._r,255))+"%, "+a(100*C(this._g,255))+"%, "+a(100*C(this._b,255))+"%)":"rgba("+a(100*C(this._r,255))+"%, "+a(100*C(this._g,255))+"%, "+a(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(L[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+d(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=u(t);r="#"+d(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return u(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(T,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(A,arguments)}},u.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:z(t[n]));t=r}return u(t,e)},u.equals=function(t,e){return!(!t||!e)&&u(t).toRgbString()==u(e).toRgbString()},u.random=function(){return u.fromRatio({r:l(),g:l(),b:l()})},u.mix=function(t,e,r){r=0===r?0:r||50;var n=u(t).toRgb(),i=u(e).toRgb(),a=r/100;return u({r:(i.r-n.r)*a+n.r,g:(i.g-n.g)*a+n.g,b:(i.b-n.b)*a+n.b,a:(i.a-n.a)*a+n.a})},u.readability=function(e,r){var n=u(e),i=u(r);return(t.max(n.getLuminance(),i.getLuminance())+.05)/(t.min(n.getLuminance(),i.getLuminance())+.05)},u.isReadable=function(t,e,r){var n,i,a=u.readability(t,e);switch(i=!1,(n=function(t){var e,r;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==r&&"large"!==r&&(r="small");return{level:e,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":i=a>=4.5;break;case"AAlarge":i=a>=3;break;case"AAAsmall":i=a>=7}return i},u.mostReadable=function(t,e,r){var n,i,a,o,s=null,l=0;i=(r=r||{}).includeFallbackColors,a=r.level,o=r.size;for(var c=0;cl&&(l=n,s=u(e[c]));return u.isReadable(t,s,{level:a,size:o})||!i?s:(r.includeFallbackColors=!1,u.mostReadable(t,["#fff","#000"],r))};var E=u.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},L=u.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(E);function S(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function C(e,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(e)&&(e="100%");var n=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(e);return e=o(r,s(0,parseFloat(e))),n&&(e=parseInt(e*r,10)/100),t.abs(e-r)<1e-6?1:e%r/parseFloat(r)}function O(t){return o(1,s(0,t))}function R(t){return parseInt(t,16)}function P(t){return 1==t.length?"0"+t:""+t}function z(t){return t<=1&&(t=100*t+"%"),t}function I(e){return t.round(255*parseFloat(e)).toString(16)}function N(t){return R(t)/255}var D,F,j,B=(F="[\\s|\\(]+("+(D="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",j="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",{CSS_UNIT:new RegExp(D),rgb:new RegExp("rgb"+F),rgba:new RegExp("rgba"+j),hsl:new RegExp("hsl"+F),hsla:new RegExp("hsla"+j),hsv:new RegExp("hsv"+F),hsva:new RegExp("hsva"+j),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function U(t){return!!B.CSS_UNIT.exec(t)}"undefined"!=typeof e&&e.exports?e.exports=u:window.tinycolor=u}(Math)},{}],343:[function(t,e,r){"use strict";var n=t("parse-unit");e.exports=o;var i=96;function a(t,e){var r=n(getComputedStyle(t).getPropertyValue(e));return r[0]*o(r[1],t)}function o(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return function(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var n=a(r,"font-size")/128;return e.removeChild(r),n}(t,e);case"em":return a(e,"font-size");case"rem":return a(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return i;case"cm":return i/2.54;case"mm":return i/25.4;case"pt":return i/72;case"pc":return i/6}return 1}},{"parse-unit":292}],344:[function(t,e,r){"use strict";e.exports=function(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(a(t+1)),r=[],o=0;oMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,l=0;l<3;++l)a+=t[l]*t[l],o+=i[l]*t[l];for(l=0;l<3;++l)i[l]-=o/a*t[l];return s(i,i),i}function h(t,e,r,i,a,o,s,l){this.center=n(r),this.up=n(i),this.right=n(a),this.radius=n([o]),this.angle=n([s,l]),this.angle.bounds=[[-1/0,-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;u<16;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}var d=h.prototype;d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-1/0,e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,n=0,i=0,a=0;a<3;++a)i+=e[a]*r[a],n+=e[a]*e[a];var l=Math.sqrt(n),c=0;for(a=0;a<3;++a)r[a]-=e[a]*i/n,c+=r[a]*r[a],e[a]/=l;var f=Math.sqrt(c);for(a=0;a<3;++a)r[a]/=f;var h=this.computedToward;o(h,e,r),s(h,h);var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],v=Math.cos(p),m=Math.sin(p),y=Math.cos(g),b=Math.sin(g),x=this.computedCenter,_=v*y,w=m*y,A=b,M=-v*b,T=-m*b,k=y,E=this.computedEye,L=this.computedMatrix;for(a=0;a<3;++a){var S=_*r[a]+w*h[a]+A*e[a];L[4*a+1]=M*r[a]+T*h[a]+k*e[a],L[4*a+2]=S,L[4*a+3]=0}var C=L[1],O=L[5],R=L[9],P=L[2],z=L[6],I=L[10],N=O*I-R*z,D=R*P-C*I,F=C*z-O*P,j=u(N,D,F);N/=j,D/=j,F/=j,L[0]=N,L[4]=D,L[8]=F;for(a=0;a<3;++a)E[a]=x[a]+L[2+4*a]*d;for(a=0;a<3;++a){c=0;for(var B=0;B<3;++B)c+=L[a+4*B]*E[B];L[12+a]=-c}L[15]=1},d.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r};var p=[0,0,0];d.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;p[0]=i[2],p[1]=i[6],p[2]=i[10];for(var o=this.computedUp,s=this.computedRight,l=this.computedToward,u=0;u<3;++u)i[4*u]=o[u],i[4*u+1]=s[u],i[4*u+2]=l[u];a(i,i,n,p);for(u=0;u<3;++u)o[u]=i[4*u],s[u]=i[4*u+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,s[0],s[1],s[2])}},d.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=(Math.exp(this.computedRadius[0]),i[1]),o=i[5],s=i[9],l=u(a,o,s);a/=l,o/=l,s/=l;var c=i[0],f=i[4],h=i[8],d=c*a+f*o+h*s,p=u(c-=a*d,f-=o*d,h-=s*d),g=(c/=p)*e+a*r,v=(f/=p)*e+o*r,m=(h/=p)*e+s*r;this.center.move(t,g,v,m);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+n),this.radius.set(t,Math.log(y))},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e,r,n){var a=1;"number"==typeof r&&(a=0|r),(a<0||a>3)&&(a=1);var o=(a+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var s=e[a],l=e[a+4],f=e[a+8];if(n){var h=Math.abs(s),d=Math.abs(l),p=Math.abs(f),g=Math.max(h,d,p);h===g?(s=s<0?-1:1,l=f=0):p===g?(f=f<0?-1:1,s=l=0):(l=l<0?-1:1,s=f=0)}else{var v=u(s,l,f);s/=v,l/=v,f/=v}var m,y,b=e[o],x=e[o+4],_=e[o+8],w=b*s+x*l+_*f,A=u(b-=s*w,x-=l*w,_-=f*w),M=l*(_/=A)-f*(x/=A),T=f*(b/=A)-s*_,k=s*x-l*b,E=u(M,T,k);if(M/=E,T/=E,k/=E,this.center.jump(t,q,G,X),this.radius.idle(t),this.up.jump(t,s,l,f),this.right.jump(t,b,x,_),2===a){var L=e[1],S=e[5],C=e[9],O=L*b+S*x+C*_,R=L*M+S*T+C*k;m=N<0?-Math.PI/2:Math.PI/2,y=Math.atan2(R,O)}else{var P=e[2],z=e[6],I=e[10],N=P*s+z*l+I*f,D=P*b+z*x+I*_,F=P*M+z*T+I*k;m=Math.asin(c(N)),y=Math.atan2(F,D)}this.angle.jump(t,y,m),this.recalcMatrix(t);var j=e[2],B=e[6],U=e[10],V=this.computedMatrix;i(V,e);var H=V[15],q=V[12]/H,G=V[13]/H,X=V[14]/H,W=Math.exp(this.computedRadius[0]);this.center.jump(t,q-j*W,G-B*W,X-U*W)},d.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},d.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},d.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter;var i=(n=n||this.computedUp)[0],a=n[1],o=n[2],s=u(i,a,o);if(!(s<1e-6)){i/=s,a/=s,o/=s;var l=e[0]-r[0],f=e[1]-r[1],h=e[2]-r[2],d=u(l,f,h);if(!(d<1e-6)){l/=d,f/=d,h/=d;var p=this.computedRight,g=p[0],v=p[1],m=p[2],y=i*g+a*v+o*m,b=u(g-=y*i,v-=y*a,m-=y*o);if(!(b<.01&&(b=u(g=a*h-o*f,v=o*l-i*h,m=i*f-a*l))<1e-6)){g/=b,v/=b,m/=b,this.up.set(t,i,a,o),this.right.set(t,g,v,m),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=a*m-o*v,_=o*g-i*m,w=i*v-a*g,A=u(x,_,w),M=i*l+a*f+o*h,T=g*l+v*f+m*h,k=(x/=A)*l+(_/=A)*f+(w/=A)*h,E=Math.asin(c(M)),L=Math.atan2(k,T),S=this.angle._state,C=S[S.length-1],O=S[S.length-2];C%=2*Math.PI;var R=Math.abs(C+2*Math.PI-L),P=Math.abs(C-L),z=Math.abs(C-2*Math.PI-L);R0?r.pop():new ArrayBuffer(t)}function h(t){return new Uint8Array(f(t),0,t)}function d(t){return new Uint16Array(f(2*t),0,t)}function p(t){return new Uint32Array(f(4*t),0,t)}function g(t){return new Int8Array(f(t),0,t)}function v(t){return new Int16Array(f(2*t),0,t)}function m(t){return new Int32Array(f(4*t),0,t)}function y(t){return new Float32Array(f(4*t),0,t)}function b(t){return new Float64Array(f(8*t),0,t)}function x(t){return o?new Uint8ClampedArray(f(t),0,t):h(t)}function _(t){return new DataView(f(t),0,t)}function w(t){t=i.nextPow2(t);var e=i.log2(t),r=u[e];return r.length>0?r.pop():new n(t)}r.free=function(t){if(n.isBuffer(t))u[i.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|i.log2(e);l[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){c(t.buffer)},r.freeArrayBuffer=c,r.freeBuffer=function(t){u[i.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return f(t);switch(e){case"uint8":return h(t);case"uint16":return d(t);case"uint32":return p(t);case"int8":return g(t);case"int16":return v(t);case"int32":return m(t);case"float":case"float32":return y(t);case"double":case"float64":return b(t);case"uint8_clamped":return x(t);case"buffer":return w(t);case"data":case"dataview":return _(t);default:return null}return null},r.mallocArrayBuffer=f,r.mallocUint8=h,r.mallocUint16=d,r.mallocUint32=p,r.mallocInt8=g,r.mallocInt16=v,r.mallocInt32=m,r.mallocFloat32=r.mallocFloat=y,r.mallocFloat64=r.mallocDouble=b,r.mallocUint8Clamped=x,r.mallocDataView=_,r.mallocBuffer=w,r.clearCache=function(){for(var t=0;t<32;++t)s.UINT8[t].length=0,s.UINT16[t].length=0,s.UINT32[t].length=0,s.INT8[t].length=0,s.INT16[t].length=0,s.INT32[t].length=0,s.FLOAT[t].length=0,s.DOUBLE[t].length=0,s.UINT8C[t].length=0,l[t].length=0,u[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":36,buffer:48,dup:86}],349:[function(t,e,r){"use strict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;e0&&(a=n.size),n.lineSpacing&&n.lineSpacing>0&&(o=n.lineSpacing),n.styletags&&n.styletags.breaklines&&(s.breaklines=!!n.styletags.breaklines),n.styletags&&n.styletags.bolds&&(s.bolds=!!n.styletags.bolds),n.styletags&&n.styletags.italics&&(s.italics=!!n.styletags.italics),n.styletags&&n.styletags.subscripts&&(s.subscripts=!!n.styletags.subscripts),n.styletags&&n.styletags.superscripts&&(s.superscripts=!!n.styletags.superscripts));return r.font=[n.fontStyle,n.fontVariant,n.fontWeight,a+"px",n.font].filter(function(t){return t}).join(" "),r.textAlign="start",r.textBaseline="alphabetic",r.direction="ltr",w(function(t,e,r,n,a,o){r=r.replace(/\n/g,""),r=!0===o.breaklines?r.replace(/\/g,"\n"):r.replace(/\/g," ");var s="",l=[];for(A=0;A-1?parseInt(t[1+i]):0,l=a>-1?parseInt(r[1+a]):0;s!==l&&(n=n.replace(D(),"?px "),k*=Math.pow(.75,l-s),n=n.replace("?px ",D())),T+=.25*S*(l-s)}if(!0===o.superscripts){var u=t.indexOf(p),f=r.indexOf(p),d=u>-1?parseInt(t[1+u]):0,g=f>-1?parseInt(r[1+f]):0;d!==g&&(n=n.replace(D(),"?px "),k*=Math.pow(.75,g-d),n=n.replace("?px ",D())),T-=.25*S*(g-d)}if(!0===o.bolds){var v=t.indexOf(c)>-1,y=r.indexOf(c)>-1;!v&&y&&(n=b?n.replace("italic ","italic bold "):"bold "+n),v&&!y&&(n=n.replace("bold ",""))}if(!0===o.italics){var b=t.indexOf(h)>-1,x=r.indexOf(h)>-1;!b&&x&&(n="italic "+n),b&&!x&&(n=n.replace("italic ",""))}e.font=n}for(w=0;w",a="",o=i.length,s=a.length,l=e[0]===p||e[0]===m,u=0,c=-s;u>-1&&-1!==(u=r.indexOf(i,u))&&-1!==(c=r.indexOf(a,u+o))&&!(c<=u);){for(var f=u;f=c)n[f]=null,r=r.substr(0,f)+" "+r.substr(f+1);else if(null!==n[f]){var h=n[f].indexOf(e[0]);-1===h?n[f]+=e:l&&(n[f]=n[f].substr(0,h+1)+(1+parseInt(n[f][h+1]))+n[f].substr(h+2))}var d=u+o,g=r.substr(d,c-d).indexOf(i);u=-1!==g?g:c+s}return n}function x(t,e){var r=n(t,128);return e?a(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}function _(t,e,r,n){var i=x(t,n),a=function(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",a=[1<<30,1<<30],o=[0,0],s=t.length,l=0;l=0?e[a]:i})},has___:{value:b(function(e){var n=y(e);return n?r in n:t.indexOf(e)>=0})},set___:{value:b(function(n,i){var a,o=y(n);return o?o[r]=i:(a=t.indexOf(n))>=0?e[a]=i:(a=t.length,e[a]=i,t[a]=n),this})},delete___:{value:b(function(n){var i,a,o=y(n);return o?r in o&&delete o[r]:!((i=t.indexOf(n))<0||(a=t.length-1,t[i]=void 0,e[i]=e[a],t[i]=t[a],t.length=a,e.length=a,0))})}})};g.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof r?function(){function n(){this instanceof g||x();var e,n=new r,i=void 0,a=!1;return e=t?function(t,e){return n.set(t,e),n.has(t)||(i||(i=new g),i.set(t,e)),this}:function(t,e){if(a)try{n.set(t,e)}catch(r){i||(i=new g),i.set___(t,e)}else n.set(t,e);return this},Object.create(g.prototype,{get___:{value:b(function(t,e){return i?n.has(t)?n.get(t):i.get___(t,e):n.get(t,e)})},has___:{value:b(function(t){return n.has(t)||!!i&&i.has___(t)})},set___:{value:b(e)},delete___:{value:b(function(t){var e=!!n.delete(t);return i&&i.delete___(t)||e})},permitHostObjects___:{value:b(function(t){if(t!==v)throw new Error("bogus call to permitHostObjects___");a=!0})}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=g.prototype,e.exports=n,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=g)}function v(t){t.permitHostObjects___&&t.permitHostObjects___(v)}function m(t){return!(t.substr(0,l.length)==l&&"___"===t.substr(t.length-3))}function y(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[u];if(e&&e.key===t)return e;if(s(t)){e={key:t};try{return o(t,u,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function b(t){return t.prototype=null,Object.freeze(t)}function x(){d||"undefined"==typeof console||(d=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},{}],354:[function(t,e,r){var n=t("./hidden-store.js");e.exports=function(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:n(e,t)}}},{"./hidden-store.js":355}],355:[function(t,e,r){e.exports=function(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}},{}],356:[function(t,e,r){var n=t("./create-store.js");e.exports=function(){var t=n();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){return t(e).value=r,this},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}},{"./create-store.js":354}],357:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":94}],358:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array",{offset:[1],array:0},"scalar","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\n var _inline_1_da = _inline_1_arg0_ - _inline_1_arg3_\n var _inline_1_db = _inline_1_arg1_ - _inline_1_arg3_\n if((_inline_1_da >= 0) !== (_inline_1_db >= 0)) {\n _inline_1_arg2_.push(_inline_1_arg4_[0] + 0.5 + 0.5 * (_inline_1_da + _inline_1_db) / (_inline_1_da - _inline_1_db))\n }\n }",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg3_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:["_inline_1_da","_inline_1_db"]},funcName:"zeroCrossings"})},{"cwise-compiler":77}],359:[function(t,e,r){"use strict";e.exports=function(t,e){var r=[];return e=+e||0,n(t.hi(t.shape[0]-1),r,e),r};var n=t("./lib/zc-core")},{"./lib/zc-core":358}],360:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0,noRotate:!0},{path:"M2,2V-2H-2V2Z",backoff:0,noRotate:!0}]},{}],361:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants"),o=t("../../plot_api/plot_template").templatedArray;e.exports=o("annotation",{visible:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},text:{valType:"string",editType:"calc+arraydraw"},textangle:{valType:"angle",dflt:0,editType:"calc+arraydraw"},font:i({editType:"calc+arraydraw",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},height:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},showarrow:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},arrowwidth:{valType:"number",min:.1,editType:"calc+arraydraw"},standoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},ax:{valType:"any",editType:"calc+arraydraw"},ay:{valType:"any",editType:"calc+arraydraw"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calc+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calc+arraydraw"},xshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calc+arraydraw"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calc+arraydraw"},yshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:i({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../plot_api/plot_template":531,"../../plots/cartesian/constants":547,"../../plots/font_attributes":567,"./arrow_paths":360}],362:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./draw").draw;function o(t){var e=t._fullLayout;n.filterVisible(e.annotations).forEach(function(e){var r=i.getFromId(t,e.xref),n=i.getFromId(t,e.yref);e._extremes={},r&&s(e,r),n&&s(e,n)})}function s(t,e){var r,n=e._id,a=n.charAt(0),o=t[a],s=t["a"+a],l=t[a+"ref"],u=t["a"+a+"ref"],c=t["_"+a+"padplus"],f=t["_"+a+"padminus"],h={x:1,y:-1}[a]*t[a+"shift"],d=3*t.arrowsize*t.arrowwidth||0,p=d+h,g=d-h,v=3*t.startarrowsize*t.arrowwidth||0,m=v+h,y=v-h;if(u===l){var b=i.findExtremes(e,[e.r2c(o)],{ppadplus:p,ppadminus:g}),x=i.findExtremes(e,[e.r2c(s)],{ppadplus:Math.max(c,m),ppadminus:Math.max(f,y)});r={min:[b.min[0],x.min[0]],max:[b.max[0],x.max[0]]}}else m=s?m+s:m,y=s?y-s:y,r=i.findExtremes(e,[e.r2c(o)],{ppadplus:Math.max(c,p,m),ppadminus:Math.max(f,g,y)});t._extremes[n]=r}e.exports=function(t){var e=t._fullLayout;if(n.filterVisible(e.annotations).length&&t._fullData.length)return n.syncOrAsync([a,o],t)}},{"../../lib":495,"../../plots/cartesian/axes":541,"./draw":367}],363:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry"),a=t("../../plot_api/plot_template").arrayEditor;function o(t,e){var r,n,i,a,o,l,u,c=t._fullLayout.annotations,f=[],h=[],d=[],p=(e||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(t,e){var r,s,l=o(t,e),u=l.on,c=l.off.concat(l.explicitOff),f={},h=t._fullLayout.annotations;if(!u.length&&!c.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}for(var H=!1,q=["x","y"],G=0;G1)&&(K===J?((lt=tt.r2fraction(e["a"+$]))<0||lt>1)&&(H=!0):H=!0),X=tt._offset+tt.r2p(e[$]),Z=.5}else"x"===$?(Y=e[$],X=x.l+x.w*Y):(Y=1-e[$],X=x.t+x.h*Y),Z=e.showarrow?.5:Y;if(e.showarrow){st.head=X;var ut=e["a"+$];Q=rt*U(.5,e.xanchor)-nt*U(.5,e.yanchor),K===J?(st.tail=tt._offset+tt.r2p(ut),W=Q):(st.tail=X+ut,W=Q+ut),st.text=st.tail+Q;var ct=b["x"===$?"width":"height"];if("paper"===J&&(st.head=o.constrain(st.head,1,ct-1)),"pixel"===K){var ft=-Math.max(st.tail-3,st.text),ht=Math.min(st.tail+3,st.text)-ct;ft>0?(st.tail+=ft,st.text+=ft):ht>0&&(st.tail-=ht,st.text-=ht)}st.tail+=ot,st.head+=ot}else W=Q=it*U(Z,at),st.text=X+Q;st.text+=ot,Q+=ot,W+=ot,e["_"+$+"padplus"]=it/2+W,e["_"+$+"padminus"]=it/2-W,e["_"+$+"size"]=it,e["_"+$+"shift"]=Q}if(t._dragging||!H){var dt=0,pt=0;if("left"!==e.align&&(dt=(w-m)*("center"===e.align?.5:1)),"top"!==e.valign&&(pt=(R-y)*("middle"===e.valign?.5:1)),c)n.select("svg").attr({x:N+dt-1,y:N+pt}).call(u.setClipUrl,F?k:null,t);else{var gt=N+pt-p.top,vt=N+dt-p.left;V.call(f.positionText,vt,gt).call(u.setClipUrl,F?k:null,t)}j.select("rect").call(u.setRect,N,N,w,R),D.call(u.setRect,z/2,z/2,I-z,B-z),P.call(u.setTranslate,Math.round(E.x.text-I/2),Math.round(E.y.text-B/2)),C.attr({transform:"rotate("+L+","+E.x.text+","+E.y.text+")"});var mt,yt=function(r,n){S.selectAll(".annotation-arrow-g").remove();var c=E.x.head,f=E.y.head,h=E.x.tail+r,p=E.y.tail+n,m=E.x.text+r,y=E.y.text+n,b=o.rotationXYMatrix(L,m,y),w=o.apply2DTransform(b),k=o.apply2DTransform2(b),O=+D.attr("width"),R=+D.attr("height"),z=m-.5*O,I=z+O,N=y-.5*R,F=N+R,j=[[z,N,z,F],[z,F,I,F],[I,F,I,N],[I,N,z,N]].map(k);if(!j.reduce(function(t,e){return t^!!o.segmentsIntersect(c,f,c+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){j.forEach(function(t){var e=o.segmentsIntersect(h,p,c,f,t[0],t[1],t[2],t[3]);e&&(h=e.x,p=e.y)});var B=e.arrowwidth,U=e.arrowcolor,V=e.arrowside,H=S.append("g").style({opacity:l.opacity(U)}).classed("annotation-arrow-g",!0),q=H.append("path").attr("d","M"+h+","+p+"L"+c+","+f).style("stroke-width",B+"px").call(l.stroke,l.rgb(U));if(g(q,V,e),_.annotationPosition&&q.node().parentNode&&!a){var G=c,X=f;if(e.standoff){var W=Math.sqrt(Math.pow(c-h,2)+Math.pow(f-p,2));G+=e.standoff*(h-c)/W,X+=e.standoff*(p-f)/W}var Y,Z,Q=H.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(h-G)+","+(p-X),transform:"translate("+G+","+X+")"}).style("stroke-width",B+6+"px").call(l.stroke,"rgba(0,0,0,0)").call(l.fill,"rgba(0,0,0,0)");d.init({element:Q.node(),gd:t,prepFn:function(){var t=u.getTranslate(P);Y=t.x,Z=t.y,s&&s.autorange&&A(s._name+".autorange",!0),v&&v.autorange&&A(v._name+".autorange",!0)},moveFn:function(t,r){var n=w(Y,Z),i=n[0]+t,a=n[1]+r;P.call(u.setTranslate,i,a),M("x",s?s.p2r(s.r2p(e.x)+t):e.x+t/x.w),M("y",v?v.p2r(v.r2p(e.y)+r):e.y-r/x.h),e.axref===e.xref&&M("ax",s.p2r(s.r2p(e.ax)+t)),e.ayref===e.yref&&M("ay",v.p2r(v.r2p(e.ay)+r)),H.attr("transform","translate("+t+","+r+")"),C.attr({transform:"rotate("+L+","+i+","+a+")"})},doneFn:function(){i.call("_guiRelayout",t,T());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&yt(0,0),O)d.init({element:P.node(),gd:t,prepFn:function(){mt=C.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?M("ax",s.p2r(s.r2p(e.ax)+t)):M("ax",e.ax+t),e.ayref===e.yref?M("ay",v.p2r(v.r2p(e.ay)+r)):M("ay",e.ay+r),yt(t,r);else{if(a)return;var i,o;if(s)i=s.p2r(s.r2p(e.x)+t);else{var l=e._xsize/x.w,u=e.x+(e._xshift-e.xshift)/x.w-l/2;i=d.align(u+t/x.w,l,0,1,e.xanchor)}if(v)o=v.p2r(v.r2p(e.y)+r);else{var c=e._ysize/x.h,f=e.y-(e._yshift+e.yshift)/x.h-c/2;o=d.align(f-r/x.h,c,0,1,e.yanchor)}M("x",i),M("y",o),s&&v||(n=d.getCursor(s?.5:i,v?.5:o,e.xanchor,e.yanchor))}C.attr({transform:"translate("+t+","+r+")"+mt}),h(P,n)},doneFn:function(){h(P),i.call("_guiRelayout",t,T());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}else P.remove()}}e.exports={draw:function(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,v=e.indexOf("end")>=0,m=f.backoff*d+r.standoff,y=h.backoff*p+r.startstandoff;if("line"===c.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},s={x:+t.attr("x2"),y:+t.attr("y2")};var b=o.x-s.x,x=o.y-s.y;if(u=(l=Math.atan2(x,b))+Math.PI,m&&y&&m+y>Math.sqrt(b*b+x*x))return void O();if(m){if(m*m>b*b+x*x)return void O();var _=m*Math.cos(l),w=m*Math.sin(l);s.x+=_,s.y+=w,t.attr({x2:s.x,y2:s.y})}if(y){if(y*y>b*b+x*x)return void O();var A=y*Math.cos(l),M=y*Math.sin(l);o.x-=A,o.y-=M,t.attr({x1:o.x,y1:o.y})}}else if("path"===c.nodeName){var T=c.getTotalLength(),k="";if(T1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l._pdata=i(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*r[0],e.yaxis.r2l(l.y)*r[1],e.zaxis.r2l(l.z)*r[2]]),n(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":579,"../annotations/draw":367}],374:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib");e.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:t("./attributes")}}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),includeBasePlot:function(t,e){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var a=r.attrRegex,o=Object.keys(t),s=0;s=0))return t;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return a?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}a.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},a.rgb=function(t){return a.tinyRGB(n(t))},a.opacity=function(t){return t?n(t).getAlpha():0},a.addOpacity=function(t,e){var r=n(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},a.combine=function(t,e){var r=n(t).toRgb();if(1===r.a)return n(t).toRgbString();var i=n(e||l).toRgb(),a=1===i.a?i:{r:255*(1-i.a)+i.r*i.a,g:255*(1-i.a)+i.g*i.a,b:255*(1-i.a)+i.b*i.a},o={r:a.r*(1-r.a)+r.r*r.a,g:a.g*(1-r.a)+r.g*r.a,b:a.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},a.contrast=function(t,e,r){var i=n(t);return 1!==i.getAlpha()&&(i=n(a.combine(t,l))),(i.isDark()?e?i.lighten(e):l:r?i.darken(r):s).toString()},a.stroke=function(t,e){var r=n(e);t.style({stroke:a.tinyRGB(r),"stroke-opacity":r.getAlpha()})},a.fill=function(t,e){var r=n(e);t.style({fill:a.tinyRGB(r),"fill-opacity":r.getAlpha()})},a.clean=function(t){if(t&&"object"==typeof t){var e,r,n,i,o=Object.keys(t);for(e=0;e0?L>=I:L<=I));S++)L>D&&L0?L>=I:L<=I));S++)L>C[0]&&L1){var ot=Math.pow(10,Math.floor(Math.log(at)/Math.LN10));nt*=ot*u.roundUp(at/ot,[2,5,10]),(Math.abs(r.levels.start)/r.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=nt}et.domain=[$+Y,$+G-Y],et.setScale();var st=u.ensureSingle(v._infolayer,"g",e,function(t){t.classed(M.colorbar,!0).each(function(){var t=n.select(this);t.append("rect").classed(M.cbbg,!0),t.append("g").classed(M.cbfills,!0),t.append("g").classed(M.cblines,!0),t.append("g").classed(M.cbaxis,!0).classed(M.crisp,!0),t.append("g").classed(M.cbtitleunshift,!0).append("g").classed(M.cbtitle,!0),t.append("rect").classed(M.cboutline,!0),t.select(".cbtitle").datum(0)})});st.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var lt=st.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")"),ut=st.select(".cbaxis"),ct=0;if(-1!==["top","bottom"].indexOf(r.title.side)){var ft,ht=A.l+(r.x+X)*A.w,dt=et.title.font.size;ft="top"===r.title.side?(1-($+G-Y))*A.h+A.t+3+.75*dt:(1-($+Y))*A.h+A.t-3-.25*dt,bt(et._id+"title",{attributes:{x:ht,y:ft,"text-anchor":"start"}})}var pt,gt,vt,mt=u.syncOrAsync([a.previousPromises,function(){if(-1!==["top","bottom"].indexOf(r.title.side)){var a=st.select(".cbtitle"),o=a.select("text"),l=[-r.outlinewidth/2,r.outlinewidth/2],c=a.select(".h"+et._id+"title-math-group").node(),f=15.6;if(o.node()&&(f=parseInt(o.node().style.fontSize,10)*m),c?(ct=h.bBox(c).height)>f&&(l[1]-=(ct-f)/2):o.node()&&!o.classed(M.jsPlaceholder)&&(ct=h.bBox(o.node()).height),ct){if(ct+=5,"top"===r.title.side)et.domain[1]-=ct/A.h,l[1]*=-1;else{et.domain[0]+=ct/A.h;var d=g.lineCount(o);l[1]+=(1-d)*f}a.attr("transform","translate("+l+")"),et.setScale()}}st.selectAll(".cbfills,.cblines").attr("transform","translate(0,"+Math.round(A.h*(1-et.domain[1]))+")"),ut.attr("transform","translate(0,"+Math.round(-A.t)+")");var p=st.select(".cbfills").selectAll("rect.cbfill").data(R);p.enter().append("rect").classed(M.cbfill,!0).style("stroke","none"),p.exit().remove();var y=C.map(et.c2p).map(Math.round).sort(function(t,e){return t-e});p.each(function(a,o){var s=[0===o?C[0]:(R[o]+R[o-1])/2,o===R.length-1?C[1]:(R[o]+R[o+1])/2].map(et.c2p).map(Math.round);s[1]=u.constrain(s[1]+(s[1]>s[0])?1:-1,y[0],y[1]);var l=n.select(this).attr({x:Z,width:Math.max(V,2),y:n.min(s),height:Math.max(n.max(s)-n.min(s),2)});if(r.fillgradient)h.gradient(l,t,e,"vertical",r.fillgradient,"fill");else{var c=z(a).replace("e-","");l.attr("fill",i(c).toHexString())}});var b=st.select(".cblines").selectAll("path.cbline").data(r.line.color&&r.line.width?O:[]);return b.enter().append("path").classed(M.cbline,!0),b.exit().remove(),b.each(function(t){n.select(this).attr("d","M"+Z+","+(Math.round(et.c2p(t))+r.line.width/2%1)+"h"+V).call(h.lineGroupStyle,r.line.width,P(t),r.line.dash)}),ut.selectAll("g."+et._id+"tick,path").remove(),u.syncOrAsync([function(){var e=Z+V+(r.outlinewidth||0)/2-("outside"===r.ticks?1:0),n=s.calcTicks(et),i=s.makeTransFn(et),a=s.getTickSigns(et)[2];return s.drawTicks(t,et,{vals:"inside"===et.ticks?s.clipEnds(et,n):n,layer:ut,path:s.makeTickPath(et,e,a),transFn:i}),s.drawLabels(t,et,{vals:n,layer:ut,transFn:i,labelFns:s.makeLabelFns(et,e)})},function(){if(-1===["top","bottom"].indexOf(r.title.side)){var e=et.title.font.size,i=et._offset+et._length/2,a=A.l+(et.position||0)*A.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));bt("h"+et._id+"title",{avoid:{selection:n.select(t).selectAll("g."+et._id+"tick"),side:r.title.side,offsetLeft:A.l,offsetTop:0,maxShift:v.width},attributes:{x:a,y:i,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])},a.previousPromises,function(){var n=V+r.outlinewidth/2+h.bBox(ut.node()).width;if((j=lt.select("text")).node()&&!j.classed(M.jsPlaceholder)){var i,o=lt.select(".h"+et._id+"title-math-group").node();i=o&&-1!==["top","bottom"].indexOf(r.title.side)?h.bBox(o).width:h.bBox(lt.node()).right-Z-A.l,n=Math.max(n,i)}var s=2*r.xpad+n+r.borderwidth+r.outlinewidth/2,l=J-K;st.select(".cbbg").attr({x:Z-r.xpad-(r.borderwidth+r.outlinewidth)/2,y:K-W,width:Math.max(s,2),height:Math.max(l+2*W,2)}).call(d.fill,r.bgcolor).call(d.stroke,r.bordercolor).style({"stroke-width":r.borderwidth}),st.selectAll(".cboutline").attr({x:Z,y:K+r.ypad+("top"===r.title.side?ct:0),width:Math.max(V,2),height:Math.max(l-2*r.ypad-ct,2)}).call(d.stroke,r.outlinecolor).style({fill:"None","stroke-width":r.outlinewidth});var u=({center:.5,right:1}[r.xanchor]||0)*s;st.attr("transform","translate("+(A.l-u)+","+A.t+")");var c={},f=y[r.yanchor],p=b[r.yanchor];"pixels"===r.lenmode?(c.y=r.y,c.t=l*f,c.b=l*p):(c.t=c.b=0,c.yt=r.y+r.len*f,c.yb=r.y-r.len*p);var g=y[r.xanchor],v=b[r.xanchor];if("pixels"===r.thicknessmode)c.x=r.x,c.l=s*g,c.r=s*v;else{var m=s-V;c.l=m*g,c.r=m*v,c.xl=r.x-r.thickness*g,c.xr=r.x+r.thickness*v}a.autoMargin(t,e,c)}],t);if(mt&&mt.then&&(t._promises||[]).push(mt),t._context.edits.colorbarPosition)l.init({element:st.node(),gd:t,prepFn:function(){pt=st.attr("transform"),f(st)},moveFn:function(t,e){st.attr("transform",pt+" translate("+t+","+e+")"),gt=l.align(Q+t/A.w,H,0,1,r.xanchor),vt=l.align($-e/A.h,G,0,1,r.yanchor);var n=l.getCursor(gt,vt,r.xanchor,r.yanchor);f(st,n)},doneFn:function(){if(f(st),void 0!==gt&&void 0!==vt){var e={};e[E("x")]=gt,e[E("y")]=vt,o.call("_guiRestyle",t,e,k().index)}}});return mt}function yt(t,e){return u.coerce(tt,et,w,t,e)}function bt(e,r){var n={propContainer:et,propName:E("title"),traceIndex:k().index,placeholder:v._dfltTitle.colorbar,containerGroup:st.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;st.selectAll("."+i+",."+i+"-math-group").remove(),p.draw(t,e,c(n,r||{}))}v._infolayer.selectAll("g."+e).remove()}function k(){for(var r=e.substr(2),n=0;ng-d?d=g-(p-g):p-g=0?i.colorscale.sequential:i.colorscale.sequentialminus,l._colorscale=l.colorscale=v)}},{"../../lib":495}],385:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./helpers").hasColorscale;e.exports=function(t){function e(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function r(t,r){var i=r.container?n.nestedProperty(t,r.container).get():t;if(i){var a=i.zauto||i.cauto,o=r.min,s=r.max;(a||void 0===i[o])&&e(i,o),(a||void 0===i[s])&&e(i,s),i.autocolorscale&&e(i,"colorscale")}}for(var a=0;a=0;n--,i++){var a=t[n];r[i]=[1-a[0],a[1]]}return r}function c(t){var e={r:t[0],g:t[1],b:t[2],a:t[3]};return i(e).toRgbString()}e.exports={hasColorscale:function(t,e){var r=e?o.nestedProperty(t,e).get()||{}:t,n=r.color,i=!1;if(o.isArrayOrTypedArray(n))for(var s=0;s4/3-s?o:s}},{}],393:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,a){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":495}],394:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),i=t("has-hover"),a=t("has-passive-events"),o=t("../../registry"),s=t("../../lib"),l=t("../../plots/cartesian/constants"),u=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var f=t("./unhover");function h(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function d(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}c.unhover=f.wrapped,c.unhoverRaw=f.raw,c.init=function(t){var e,r,n,f,p,g,v,m,y=t.gd,b=1,x=u.DBLCLICKDELAY,_=t.element;y._mouseDownTime||(y._mouseDownTime=0),_.style.pointerEvents="all",_.onmousedown=A,a?(_._ontouchstart&&_.removeEventListener("touchstart",_._ontouchstart),_._ontouchstart=A,_.addEventListener("touchstart",A,{passive:!1})):_.ontouchstart=A;var w=t.clampFn||function(t,e,r){return Math.abs(t)x&&(b=Math.max(b-1,1)),y._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(b,g),!m){var r;try{r=new MouseEvent("click",e)}catch(t){var n=d(e);(r=document.createEvent("MouseEvents")).initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,n[0],n[1],e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}v.dispatchEvent(r)}!function(t){t._dragging=!1,t._replotPending&&o.call("plot",t)}(y),y._dragged=!1}else y._dragged=!1}},c.coverSlip=h},{"../../constants/interactions":474,"../../lib":495,"../../plots/cartesian/constants":547,"../../registry":592,"./align":392,"./cursor":393,"./unhover":395,"has-hover":251,"has-passive-events":252,"mouse-event-offset":272}],395:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=t("../../lib/throttle"),a=t("../../lib/get_graph_div"),o=t("../fx/constants"),s=e.exports={};s.wrapped=function(t,e,r){(t=a(t))._fullLayout&&i.clear(t._fullLayout._uid+o.HOVERID),s.raw(t,e,r)},s.raw=function(t,e){var r=t._fullLayout,i=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":487,"../../lib/get_graph_div":492,"../../lib/throttle":519,"../fx/constants":409}],396:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],397:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../../registry"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),h=t("../../constants/alignment").LINE_SPACING,d=t("../../constants/interactions").DESELECTDIM,p=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),v=e.exports={};v.font=function(t,e,r,n){u.isPlainObject(e)&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},v.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},v.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},v.setRect=function(t,e,r,n,i){t.call(v.setPosition,e,r).call(v.setSize,n,i)},v.translatePoint=function(t,e,r,n){var a=r.c2p(t.x),o=n.c2p(t.y);return!!(i(a)&&i(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0)},v.translatePoints=function(t,e,r){t.each(function(t){var i=n.select(this);v.translatePoint(t,i,e,r)})},v.hideOutsideRangePoint=function(t,e,r,n,i,a){e.attr("display",r.isPtWithinRange(t,i)&&n.isPtWithinRange(t,a)?null:"none")},v.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,i=e.yaxis;t.each(function(e){var a=e[0].trace,o=a.xcalendar,s=a.ycalendar,l="bar"===a.type?".bartext":"waterfall"===a.type?".bartext,.line":".point,.textpoint";t.selectAll(l).each(function(t){v.hideOutsideRangePoint(t,n.select(this),r,i,o,s)})})}},v.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},v.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,l=i||a.dash||"";s.stroke(e,n||a.color),v.dashLine(e,l,o)},v.lineGroupStyle=function(t,e,r,i){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=i||a.dash||"";n.select(this).call(s.stroke,r||a.color).call(v.dashLine,l,o)})},v.dashLine=function(t,e,r){r=+r||0,e=v.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},v.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},v.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(s.fill,e)},v.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(t){var e=n.select(this);t[0].trace&&e.call(s.fill,t[0].trace.fillcolor)})};var m=t("./symbol_defs");v.symbolNames=[],v.symbolFuncs=[],v.symbolNeedLines={},v.symbolNoDot={},v.symbolNoFill={},v.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];v.symbolList=v.symbolList.concat([e.n,t,e.n+100,t+"-open"]),v.symbolNames[e.n]=t,v.symbolFuncs[e.n]=e.f,e.needLine&&(v.symbolNeedLines[e.n]=!0),e.noDot?v.symbolNoDot[e.n]=!0:v.symbolList=v.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"]),e.noFill&&(v.symbolNoFill[e.n]=!0)});var y=v.symbolNames.length,b="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";function x(t,e){var r=t%100;return v.symbolFuncs[r](e)+(t>=200?b:"")}v.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),(t=v.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=y||t>=400?0:Math.floor(Math.max(t,0))};var _={x1:1,x2:0,y1:0,y2:0},w={x1:0,x2:0,y1:1,y2:0},A=n.format("~.1f"),M={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:_},horizontalreversed:{node:"linearGradient",attrs:_,reversed:!0},vertical:{node:"linearGradient",attrs:w},verticalreversed:{node:"linearGradient",attrs:w,reversed:!0}};v.gradient=function(t,e,r,i,o,l){for(var c=o.length,f=M[i],h=new Array(c),d=0;d=100,e.attr("d",x(c,l))}var f,h,d,p=!1;if(t.so)d=o.outlierwidth,h=o.outliercolor,f=a.outliercolor;else{var g=(o||{}).width;d=(t.mlw+1||g+1||(t.trace?(t.trace.marker.line||{}).width:0)+1)-1||0,h="mlc"in t?t.mlcc=n.lineScale(t.mlc):u.isArrayOrTypedArray(o.color)?s.defaultLine:o.color,u.isArrayOrTypedArray(a.color)&&(f=s.defaultLine,p=!0),f="mc"in t?t.mcc=n.markerScale(t.mc):a.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(t))}if(t.om)e.call(s.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var m=a.gradient,y=t.mgt;if(y?p=!0:y=m&&m.type,Array.isArray(y)&&(y=y[0],M[y]||(y=0)),y&&"none"!==y){var b=t.mgc;b?p=!0:b=m.color;var _=r.uid;p&&(_+="-"+t.i),v.gradient(e,i,_,y,[[0,b],[1,f]],"fill")}else s.fill(e,f);d&&s.stroke(e,h)}},v.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=v.tryColorscale(r,""),e.lineScale=v.tryColorscale(r,"line"),o.traceIs(t,"symbols")&&(e.ms2mrc=p.isBubble(t)?g(t):function(){return(r.size||6)/2}),t.selectedpoints&&u.extendFlat(e,v.makeSelectedPointStyleFns(t)),e},v.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},i=t.marker||{},a=r.marker||{},s=n.marker||{},l=i.opacity,c=a.opacity,f=s.opacity,h=void 0!==c,p=void 0!==f;(u.isArrayOrTypedArray(l)||h||p)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?i.opacity:t.mo;return t.selected?h?c:e:p?f:d*e});var g=i.color,v=a.color,m=s.color;(v||m)&&(e.selectedColorFn=function(t){var e=t.mcc||g;return t.selected?v||e:m||e});var y=i.size,b=a.size,x=s.size,_=void 0!==b,w=void 0!==x;return o.traceIs(t,"symbols")&&(_||w)&&(e.selectedSizeFn=function(t){var e=t.mrc||y/2;return t.selected?_?b/2:e:w?x/2:e}),e},v.makeSelectedTextStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},i=t.textfont||{},a=r.textfont||{},o=n.textfont||{},l=i.color,u=a.color,c=o.color;return e.selectedTextColorFn=function(t){var e=t.tc||l;return t.selected?u||e:c||(u?e:s.addOpacity(e,d))},e},v.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=v.makeSelectedPointStyleFns(e),i=e.marker||{},a=[];r.selectedOpacityFn&&a.push(function(t,e){t.style("opacity",r.selectedOpacityFn(e))}),r.selectedColorFn&&a.push(function(t,e){s.fill(t,r.selectedColorFn(e))}),r.selectedSizeFn&&a.push(function(t,e){var n=e.mx||i.symbol||0,a=r.selectedSizeFn(e);t.attr("d",x(v.symbolNumber(n),a)),e.mrc2=a}),a.length&&t.each(function(t){for(var e=n.select(this),r=0;r0?r:0}v.textPointStyle=function(t,e,r){if(t.size()){var i;if(e.selectedpoints){var a=v.makeSelectedTextStyleFns(e);i=a.selectedTextColorFn}t.each(function(t){var a=n.select(this),o=u.extractOption(t,e,"tx","text");if(o||0===o){var s=t.tp||e.textposition,l=E(t,e),f=i?i(t):t.tc||e.textfont.color;a.call(v.font,t.tf||e.textfont.family,l,f).text(o).call(c.convertToTspans,r).call(k,s,l,t.mrc)}else a.remove()})}},v.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=v.makeSelectedTextStyleFns(e);t.each(function(t){var i=n.select(this),a=r.selectedTextColorFn(t),o=t.tp||e.textposition,l=E(t,e);s.fill(i,a),k(i,o,l,t.mrc2||t.mrc)})}};var L=.5;function S(t,e,r,i){var a=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(a*a+o*o,L/2),c=Math.pow(s*s+l*l,L/2),f=(c*c*a-u*u*s)*i,h=(c*c*o-u*u*l)*i,d=3*c*(u+c),p=3*u*(u+c);return[[n.round(e[0]+(d&&f/d),2),n.round(e[1]+(d&&h/d),2)],[n.round(e[0]-(p&&f/p),2),n.round(e[1]-(p&&h/p),2)]]}v.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],i=[];for(r=1;r=1e4&&(v.savedBBoxes={},R=0),r&&(v.savedBBoxes[r]=m),R++,u.extendFlat({},m)},v.setClipUrl=function(t,e,r){if(e){var n=r._context,i=n._exportedPlot?"":n._baseUrl||"";t.attr("clip-path","url("+i+"#"+e+")")}else t.attr("clip-path",null)},v.getTranslate=function(t){var e=(t[t.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+e[0]||0,y:+e[1]||0}},v.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||0,r=r||0,a=a.replace(/(\btranslate\(.*?\);?)/,"").trim(),a=(a+=" translate("+e+", "+r+")").trim(),t[i]("transform",a),a},v.getScale=function(t){var e=(t[t.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+e[0]||1,y:+e[1]||1}},v.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||1,r=r||1,a=a.replace(/(\bscale\(.*?\);?)/,"").trim(),a=(a+=" scale("+e+", "+r+")").trim(),t[i]("transform",a),a};var z=/\s*sc.*/;v.setPointGroupScale=function(t,e,r){if(e=e||1,r=r||1,t){var n=1===e&&1===r?"":" scale("+e+","+r+")";t.each(function(){var t=(this.getAttribute("transform")||"").replace(z,"");t=(t+=n).trim(),this.setAttribute("transform",t)})}};var I=/translate\([^)]*\)\s*$/;v.setTextPointsScale=function(t,e,r){t&&t.each(function(){var t,i=n.select(this),a=i.select("text");if(a.node()){var o=parseFloat(a.attr("x")||0),s=parseFloat(a.attr("y")||0),l=(i.attr("transform")||"").match(I);t=1===e&&1===r?[]:["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"],l&&t.push(l),i.attr("transform",t.join(" "))}})}},{"../../constants/alignment":471,"../../constants/interactions":474,"../../constants/xmlns_namespaces":476,"../../lib":495,"../../lib/svg_text_utils":518,"../../registry":592,"../../traces/scatter/make_bubble_size_func":633,"../../traces/scatter/subtypes":640,"../color":376,"../colorscale":388,"./symbol_defs":398,d3:81,"fast-isnumeric":90,tinycolor2:342}],398:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(-.309*t,2);return"M"+e+","+a+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),u=n.round(.118*e,2),c=n.round(.809*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"L-"+o+","+c+"L-"+a+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+i+o+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+i+o+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0,noFill:!0}}},{d3:81}],399:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean",editType:"calc"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"],editType:"calc"},symmetric:{valType:"boolean",editType:"calc"},array:{valType:"data_array",editType:"calc"},arrayminus:{valType:"data_array",editType:"calc"},value:{valType:"number",min:0,dflt:10,editType:"calc"},valueminus:{valType:"number",min:0,dflt:10,editType:"calc"},traceref:{valType:"integer",min:0,dflt:0,editType:"style"},tracerefminus:{valType:"integer",min:0,dflt:0,editType:"style"},copy_ystyle:{valType:"boolean",editType:"plot"},copy_zstyle:{valType:"boolean",editType:"style"},color:{valType:"color",editType:"style"},thickness:{valType:"number",min:0,dflt:2,editType:"style"},width:{valType:"number",min:0,editType:"plot"},editType:"calc",_deprecated:{opacity:{valType:"number",editType:"style"}}}},{}],400:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../registry"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),s=t("./compute_error");function l(t,e,r,i){var l=e["error_"+i]||{},u=[];if(l.visible&&-1!==["linear","log"].indexOf(r.type)){for(var c=s(l),f=0;f0;e.each(function(e){var f,h=e[0].trace,d=h.error_x||{},p=h.error_y||{};h.ids&&(f=function(t){return t.id});var g=o.hasMarkers(h)&&h.marker.maxdisplayed>0;p.visible||d.visible||(e=[]);var v=n.select(this).selectAll("g.errorbar").data(e,f);if(v.exit().remove(),e.length){d.visible||v.selectAll("path.xerror").remove(),p.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);c&&m.style("opacity",0).transition().duration(s.duration).style("opacity",1),a.setClipUrl(v,r.layerClipId,t),v.each(function(t){var e=n.select(this),r=function(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),i(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0)));void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),i(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0)));return n}(t,l,u);if(!g||t.vis){var a,o=e.select("path.yerror");if(p.visible&&i(r.x)&&i(r.yh)&&i(r.ys)){var f=p.width;a="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(a+="m-"+f+",0h"+2*f),!o.size()?o=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):c&&(o=o.transition().duration(s.duration).ease(s.easing)),o.attr("d",a)}else o.remove();var h=e.select("path.xerror");if(d.visible&&i(r.y)&&i(r.xh)&&i(r.xs)){var v=(d.copy_ystyle?p:d).width;a="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(a+="m0,-"+v+"v"+2*v),!h.size()?h=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):c&&(h=h.transition().duration(s.duration).ease(s.easing)),h.attr("d",a)}else h.remove()}})}})}},{"../../traces/scatter/subtypes":640,"../drawing":397,d3:81,"fast-isnumeric":90}],405:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},a=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),a.copy_ystyle&&(a=r),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":376,d3:81}],406:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0,editType:"none"},bordercolor:{valType:"color",arrayOk:!0,editType:"none"},font:n({arrayOk:!0,editType:"none"}),namelength:{valType:"integer",min:-1,arrayOk:!0,editType:"none"},editType:"calc"}}},{"../../plots/font_attributes":567}],407:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry");function a(t,e,r,i){i=i||n.identity,Array.isArray(t)&&(e[0][r]=i(t))}e.exports=function(t){var e=t.calcdata,r=t._fullLayout;function o(t){return function(e){return n.coerceHoverinfo({hoverinfo:e},{_module:t._module},r)}}for(var s=0;s=0&&r.indexw[0]._length||et<0||et>A[0]._length)return h.unhoverRaw(t,e)}if(e.pointerX=tt+w[0]._offset,e.pointerY=et+A[0]._offset,I="xval"in e?g.flat(l,e.xval):g.p2c(w,tt),N="yval"in e?g.flat(l,e.yval):g.p2c(A,et),!i(I[0])||!i(N[0]))return o.warn("Fx.hover failed",e,t),h.unhoverRaw(t,e)}var it=1/0;for(F=0;F<$.length;F++)if((j=$[F])&&j[0]&&j[0].trace&&!0===j[0].trace.visible&&(B=j[0].trace,-1===["carpet","contourcarpet"].indexOf(B._module.name))){if("splom"===B.type?U=l[V=0]:(U=g.getSubplot(B),V=l.indexOf(U)),H=z,X={cd:j,trace:B,xa:w[V],ya:A[V],maxHoverDistance:Y,maxSpikeDistance:Z,index:!1,distance:Math.min(it,Y),spikeDistance:1/0,xSpike:void 0,ySpike:void 0,color:f.defaultLine,name:B.name,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},c[U]&&(X.subplot=c[U]._subplot),c._splomScenes&&c._splomScenes[B.uid]&&(X.scene=c._splomScenes[B.uid]),W=Q.length,"array"===H){var at=e[F];"pointNumber"in at?(X.index=at.pointNumber,H="closest"):(H="","xval"in at&&(q=at.xval,H="x"),"yval"in at&&(G=at.yval,H=H?"closest":"y"))}else q=I[V],G=N[V];if(0!==Y)if(B._module&&B._module.hoverPoints){var ot=B._module.hoverPoints(X,q,G,H,c._hoverlayer);if(ot)for(var st,lt=0;ltW&&(Q.splice(0,W),it=Q[0].distance),y&&0!==Z&&0===Q.length){X.distance=Z,X.index=!1;var ut=B._module.hoverPoints(X,q,G,"closest",c._hoverlayer);if(ut&&(ut=ut.filter(function(t){return t.spikeDistance<=Z})),ut&&ut.length){var ct,ft=ut.filter(function(t){return t.xa.showspikes});if(ft.length){var ht=ft[0];i(ht.x0)&&i(ht.y0)&&(ct=vt(ht),(!J.vLinePoint||J.vLinePoint.spikeDistance>ct.spikeDistance)&&(J.vLinePoint=ct))}var dt=ut.filter(function(t){return t.ya.showspikes});if(dt.length){var pt=dt[0];i(pt.x0)&&i(pt.y0)&&(ct=vt(pt),(!J.hLinePoint||J.hLinePoint.spikeDistance>ct.spikeDistance)&&(J.hLinePoint=ct))}}}}function gt(t,e){for(var r,n=null,i=1/0,a=0;a1||Q.length>1)||"closest"===z&&K&&Q.length>1,Ot=f.combine(c.plot_bgcolor||f.background,c.paper_bgcolor),Rt={hovermode:z,rotateLabels:Ct,bgColor:Ot,container:c._hoverlayer,outerContainer:c._paperdiv,commonLabelOpts:c.hoverlabel,hoverdistance:c.hoverdistance},Pt=T(Q,Rt,t);if(function(t,e,r){var n,i,a,o,s,l,u,c=0,f=1,h=t.size(),d=new Array(h);function p(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(a<.01)){if(i<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=a;n=!1}if(n){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)(l=t[o]).pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)(l=t[o]).pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(t.each(function(t,n){var i=t[e],a="x"===i._id.charAt(0),o=i.range;!n&&o&&o[0]>o[1]!==a&&(f=-1),d[n]=[{datum:t,i:n,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(a?b:1)/2,pmin:0,pmax:a?r.width:r.height}]}),d.sort(function(t,e){return t[0].posref-e[0].posref||f*(e[0].traceIndex-t[0].traceIndex)});!n&&c<=h;){for(c++,n=!0,o=0;o.01&&m.pmin===y.pmin&&m.pmax===y.pmax){for(s=v.length-1;s>=0;s--)v[s].dp+=i;for(g.push.apply(g,v),d.splice(o+1,1),u=0,s=g.length-1;s>=0;s--)u+=g[s].dp;for(a=u/g.length,s=g.length-1;s>=0;s--)g[s].dp-=a;n=!1}else o++}d.forEach(p)}for(o=d.length-1;o>=0;o--){var x=d[o];for(s=x.length-1;s>=0;s--){var _=x[s],w=_.datum;w.offset=_.dp,w.del=_.del}}}(Pt,Ct?"xa":"ya",c),k(Pt,Ct),e.target&&e.target.tagName){var zt=p.getComponentMethod("annotations","hasClickToShow")(t,kt);u(n.select(e.target),zt?"pointer":"")}if(!e.target||a||!function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber)||String(i.pointNumbers)!==String(a.pointNumbers))return!0}return!1}(t,0,Tt))return;Tt&&t.emit("plotly_unhover",{event:e,points:Tt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:w,yaxes:A,xvals:I,yvals:N})}(t,e,r,a)})},r.loneHover=function(t,e){var r={color:t.color||f.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:t.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:t.hovertemplate||!1,eventData:t.eventData||!1,hovertemplateLabels:t.hovertemplateLabels||!1},i=n.select(e.container),a=e.outerContainer?n.select(e.outerContainer):i,o={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||f.background,container:i,outerContainer:a},s=T([r],o,e.gd);return k(s,o.rotateLabels),s.node()},r.multiHovers=function(t,e){Array.isArray(t)||(t=[t]);var r=t.map(function(t){return{color:t.color||f.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:t.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:t.hovertemplate||!1,eventData:t.eventData||!1,hovertemplateLabels:t.hovertemplateLabels||!1}}),i=n.select(e.container),a=e.outerContainer?n.select(e.outerContainer):i,o={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||f.background,container:i,outerContainer:a},s=T(r,o,e.gd),l=0;return s.sort(function(t,e){return t.y0-e.y0}).each(function(t){var e=t.y0-t.by/2;t.offset=e-5([\s\S]*)<\/extra>/;function T(t,e,r){var i=r._fullLayout,a=e.hovermode,s=e.rotateLabels,u=e.bgColor,h=e.container,d=e.outerContainer,p=e.commonLabelOpts||{},g=e.fontFamily||v.HOVERFONT,y=e.fontSize||v.HOVERFONTSIZE,b=t[0],x=b.xa,_=b.ya,T="y"===a?"yLabel":"xLabel",k=b[T],E=(String(k)||"").split(" ")[0],L=d.node().getBoundingClientRect(),S=L.top,C=L.width,O=L.height,R=void 0!==k&&b.distance<=e.hoverdistance&&("x"===a||"y"===a);if(R){var P,z,I=!0;for(P=0;P"),void 0!==t.yLabel&&(d+="y: "+t.yLabel+"
"),d+=(d?"z: ":"")+t.zLabel):R&&t[a+"Label"]===k?d=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(d=t.yLabel):d=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(d+=(d?"
":"")+t.text),void 0!==t.extraText&&(d+=(d?"
":"")+t.extraText),""!==d||t.hovertemplate||(""===h&&e.remove(),d=h);var _=r._fullLayout._d3locale,T=t.hovertemplate||!1,E=t.hovertemplateLabels||t,L=t.eventData[0]||{};T&&(d=(d=o.hovertemplateString(T,E,_,L,{meta:i.meta})).replace(M,function(t,e){return h=e,""}));var P=e.select("text.nums").call(c.font,t.fontFamily||g,t.fontSize||y,t.fontColor||x).text(d).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r),z=e.select("text.name"),I=0,N=0;if(h&&h!==d){z.call(c.font,t.fontFamily||g,t.fontSize||y,b).text(h).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r);var D=z.node().getBoundingClientRect();I=D.width+2*A,N=D.height+2*A}else z.remove(),e.select("rect").remove();e.select("path").style({fill:v,stroke:x});var F,j,B=P.node().getBoundingClientRect(),U=t.xa._offset+(t.x0+t.x1)/2,V=t.ya._offset+(t.y0+t.y1)/2,H=Math.abs(t.x1-t.x0),q=Math.abs(t.y1-t.y0),G=B.width+w+A+I;if(t.ty0=S-B.top,t.bx=B.width+2*A,t.by=Math.max(B.height+2*A,N),t.anchor="start",t.txwidth=B.width,t.tx2width=I,t.offset=0,s)t.pos=U,F=V+q/2+G<=O,j=V-q/2-G>=0,"top"!==t.idealAlign&&F||!j?F?(V+=q/2,t.anchor="start"):t.anchor="middle":(V-=q/2,t.anchor="end");else if(t.pos=V,F=U+H/2+G<=C,j=U-H/2-G>=0,"left"!==t.idealAlign&&F||!j)if(F)U+=H/2,t.anchor="start";else{t.anchor="middle";var X=G/2,W=U+X-C,Y=U-X;W>0&&(U-=W),Y<0&&(U+=-Y)}else U-=H/2,t.anchor="end";P.attr("text-anchor",t.anchor),I&&z.attr("text-anchor",t.anchor),e.attr("transform","translate("+U+","+V+")"+(s?"rotate("+m+")":""))}),F}function k(t,e){t.each(function(t){var r=n.select(this);if(t.del)r.remove();else{var i="end"===t.anchor?-1:1,a=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],s=o*(w+A),u=s+o*(t.txwidth+A),f=0,h=t.offset;"middle"===t.anchor&&(s-=t.tx2width/2,u+=t.txwidth/2+A),e&&(h*=-_,f=t.offset*x),r.select("path").attr("d","middle"===t.anchor?"M-"+(t.bx/2+t.tx2width/2)+","+(h-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(i*w+f)+","+(w+h)+"v"+(t.by/2-w)+"h"+i*t.bx+"v-"+t.by+"H"+(i*w+f)+"V"+(h-w)+"Z"),a.call(l.positionText,s+f,h+t.ty0-t.by/2+A),t.tx2width&&(r.select("text.name").call(l.positionText,u+o*A+f,h+t.ty0-t.by/2+A),r.select("rect").call(c.setRect,u+(o-1)*t.tx2width/2+f,h-t.by/2-1,t.tx2width,t.by+2))}})}function E(t,e){var r=t.index,n=t.trace||{},i=t.cd[0],a=t.cd[r]||{},s=Array.isArray(r)?function(t,e){return o.castOption(i,r,t)||o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(a,n,t,e)};function l(e,r,n){var i=s(r,n);i&&(t[e]=i)}if(l("hoverinfo","hi","hoverinfo"),l("bgcolor","hbg","hoverlabel.bgcolor"),l("borderColor","hbc","hoverlabel.bordercolor"),l("fontFamily","htf","hoverlabel.font.family"),l("fontSize","hts","hoverlabel.font.size"),l("fontColor","htc","hoverlabel.font.color"),l("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e||"closest"===e&&"h"===n.orientation?t.xa._offset+(t.x0+t.x1)/2:t.ya._offset+(t.y0+t.y1)/2,t.x0=o.constrain(t.x0,0,t.xa._length),t.x1=o.constrain(t.x1,0,t.xa._length),t.y0=o.constrain(t.y0,0,t.ya._length),t.y1=o.constrain(t.y1,0,t.ya._length),void 0!==t.xLabelVal&&(t.xLabel="xLabel"in t?t.xLabel:d.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:d.hoverLabelText(t.ya,t.yLabelVal),t.yVal=t.ya.c2d(t.yLabelVal)),void 0!==t.zLabelVal&&void 0===t.zLabel&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=d.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+d.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=d.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+d.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return f&&"all"!==f&&(-1===(f=Array.isArray(f)?f:f.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function L(t,e){var r,n,i=e.container,o=e.fullLayout,s=e.event,l=!!t.hLinePoint,u=!!t.vLinePoint;if(i.selectAll(".spikeline").remove(),u||l){var h=f.combine(o.plot_bgcolor,o.paper_bgcolor);if(l){var d,p,g=t.hLinePoint;r=g&&g.xa,"cursor"===(n=g&&g.ya).spikesnap?(d=s.pointerX,p=s.pointerY):(d=r._offset+g.x,p=n._offset+g.y);var v,m,y=a.readability(g.color,h)<1.5?f.contrast(h):g.color,b=n.spikemode,x=n.spikethickness,_=n.spikecolor||y,w=n._boundingBox,A=(w.left+w.right)/20){for(var n=[],i=0;i-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){h||d||p||"independent"===M("pattern")&&(h=!0),v._hasSubplotGrid=h;var b,x,_="top to bottom"===M("roworder"),w=h?.2:.1,A=h?.3:.1;g&&e._splomGridDflt&&(b=e._splomGridDflt.xside,x=e._splomGridDflt.yside),v._domains={x:c("x",M,w,b,y),y:c("y",M,A,x,m,_)}}else delete e.grid}function M(t,e){return n.coerce(r,v,l,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,i,a,o,s,l,c,h=t.grid||{},d=e._subplots,p=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(p){var b=h.subplots||[];l=r.subplots=new Array(g);var x=1;for(n=0;n1);if(!1!==b||d.uirevision){var x=a.newContainer(e,"legend");if(w("uirevision",e.uirevision),!1!==b){if(w("bgcolor",e.paper_bgcolor),w("bordercolor"),w("borderwidth"),i.coerceFont(w,"font",e.font),w("orientation"),"h"===x.orientation){var _=t.xaxis;n.getComponentMethod("rangeslider","isVisible")(_)?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}w("traceorder",v),l.isGrouped(e.legend)&&w("tracegroupgap"),w("x",u),w("xanchor",f),w("y",c),w("yanchor",h),w("valign"),i.noneOrAll(d,x,["x","y"])}}function w(t,e){return i.coerce(d,x,o,t,e)}}},{"../../lib":495,"../../plot_api/plot_template":531,"../../plots/layout_attributes":582,"../../registry":592,"./attributes":425,"./helpers":431}],428:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib/events"),l=t("../dragelement"),u=t("../drawing"),c=t("../color"),f=t("../../lib/svg_text_utils"),h=t("./handle_click"),d=t("./constants"),p=t("../../constants/interactions"),g=t("../../constants/alignment"),v=g.LINE_SPACING,m=g.FROM_TL,y=g.FROM_BR,b=t("./get_legend_data"),x=t("./style"),_=t("./helpers"),w=p.DBLCLICKDELAY;function A(t,e,r,n,i){var a=r.data()[0][0].trace,o={event:i,node:r.node(),curveNumber:a.index,expandedIndex:a._expandedIndex,data:t.data,layout:t.layout,frames:t._transitionData._frames,config:t._context,fullData:t._fullData,fullLayout:t._fullLayout};if(a._group&&(o.group=a._group),"pie"===a.type&&(o.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",o))if(1===n)e._clickTimeout=setTimeout(function(){h(r,t,n)},w);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",o)&&h(r,t,n)}}function M(t,e,r){var n=t.data()[0][0],a=e._fullLayout,s=n.trace,l=o.traceIs(s,"pie"),c=s.index,h=e._context.edits.legendText&&!l,p=l?n.label:s.name;a.meta&&(p=i.templateString(p,{meta:a.meta}));var g=i.ensureSingle(t,"text","legendtext");function m(r){f.convertToTspans(r,e,function(){!function(t,e){var r=t.data()[0][0];if(!r.trace.showlegend)return void t.remove();var n,i,a=t.select("g[class*=math-group]"),o=a.node(),s=e._fullLayout.legend.font.size*v;if(o){var l=u.bBox(o);n=l.height,i=l.width,u.setTranslate(a,0,n/4)}else{var c=t.select(".legendtext"),h=f.lineCount(c),p=c.node();n=s*h,i=p?u.bBox(p).width:0;var g=s*(.3+(1-h)/2);f.positionText(c,d.textOffsetX,g)}r.lineHeight=s,r.height=Math.max(n,16)+3,r.width=i}(t,e)})}g.attr("text-anchor","start").classed("user-select-none",!0).call(u.font,a.legend.font).text(h?T(p,r):p),f.positionText(g,d.textOffsetX,0),h?g.call(f.makeEditable,{gd:e,text:p}).call(m).on("edit",function(t){this.text(T(t,r)).call(m);var a=n.trace._fullInput||{},s={};if(o.hasTransform(a,"groupby")){var l=o.getTransformIndices(a,"groupby"),u=l[l.length-1],f=i.keyedContainer(a,"transforms["+u+"].styles","target","value.name");f.set(n.trace._group,t),s=f.constructUpdate()}else s.name=t;return o.call("_guiRestyle",e,s,c)}):m(g)}function T(t,e){var r=Math.max(4,e);if(t&&t.trim().length>=r/2)return t;for(var n=r-(t=t||"").length;n>0;n--)t+=" ";return t}function k(t,e){var r,a=1,o=i.ensureSingle(t,"rect","legendtoggle",function(t){t.style("cursor","pointer").attr("pointer-events","all").call(c.fill,"rgba(0,0,0,0)")});o.on("mousedown",function(){(r=(new Date).getTime())-e._legendMouseDownTimew&&(a=Math.max(a-1,1)),A(e,r,t,a,n.event)}})}function E(t,e,r){var a=t._fullLayout,o=a.legend,s=o.borderwidth,l=_.isGrouped(o),c=0;if(o._width=0,o._height=0,_.isVertical(o))l&&e.each(function(t,e){u.setTranslate(this,0,e*o.tracegroupgap)}),r.each(function(t){var e=t[0],r=e.height,n=e.width;u.setTranslate(this,s,5+s+o._height+r/2),o._height+=r,o._width=Math.max(o._width,n)}),o._width+=45+2*s,o._height+=10+2*s,l&&(o._height+=(o._lgroupsLength-1)*o.tracegroupgap),c=40;else if(l){var f,h=0,d=0,p=e.data(),g=0;for(f=0;f0?o.tracegroupgap:0,w.push(M),x.push(o._width)}e.each(function(t,e){u.setTranslate(this,x[e],w[e])}),e.each(function(){var t=n.select(this).selectAll("g.traces"),e=0;t.each(function(t){var r=t[0].height;u.setTranslate(this,0,5+s+e+r/2),e+=r})});var T=w[w.length-1]+h;o._height=10+2*s+T;var k=Math.max.apply(null,x);o._width=k+d+40,o._width+=2*s}else{var E=0,L=0,S=0,C=0,O=0;r.each(function(t){S=Math.max(40+t[0].width,S),O+=40+t[0].width+5});var R=a._size.w>s+O-5;r.each(function(t){var e=t[0],r=R?40+t[0].width:S;s+C+5+r>a._size.w&&(C=0,E+=L,o._height+=L,L=0),u.setTranslate(this,s+C,5+s+e.height/2+E),o._width+=5+r,C+=5+r,L=Math.max(e.height,L)}),R?o._height=L:o._height+=L,o._width+=2*s,o._height+=10+2*s}o._width=Math.ceil(o._width),o._height=Math.ceil(o._height);var P=t._context.edits.legendText||t._context.edits.legendPosition;r.each(function(t){var e=t[0],r=n.select(this).select(".legendtoggle");u.setRect(r,0,-e.height/2,(P?0:o._width)+c,e.height)})}function L(t){var e=t._fullLayout.legend,r="left";i.isRightAnchor(e)?r="right":i.isCenterAnchor(e)&&(r="center");var n="top";i.isBottomAnchor(e)?n="bottom":i.isMiddleAnchor(e)&&(n="middle"),a.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*m[r],r:e._width*y[r],b:e._height*y[n],t:e._height*m[n]})}e.exports=function(t){var e=t._fullLayout,r="legend"+e._uid;if(e._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var s=e.legend,f=e.showlegend&&b(t.calcdata,s),h=e.hiddenlabels||[];if(!e.showlegend||!f.length)return e._infolayer.selectAll(".legend").remove(),e._topdefs.select("#"+r).remove(),void a.autoMargin(t,"legend");for(var p=0,g=0;gf?function(t){var e=t._fullLayout.legend,r="left";i.isRightAnchor(e)?r="right":i.isCenterAnchor(e)&&(r="center");a.autoMargin(t,"legend",{x:e.x,y:.5,l:e._width*m[r],r:e._width*y[r],b:0,t:0})}(t):L(t);var h=e._size,p=h.l+h.w*s.x,g=h.t+h.h*(1-s.y);i.isRightAnchor(s)?p-=s._width:i.isCenterAnchor(s)&&(p-=s._width/2),i.isBottomAnchor(s)?g-=s._height:i.isMiddleAnchor(s)&&(g-=s._height/2);var v=s._width,b=h.w;v>b?(p=h.l,v=b):(p+v>c&&(p=c-v),p<0&&(p=0),v=Math.min(c-p,s._width));var x,_,w,M,T=s._height,k=h.h;if(T>k?(g=h.t,T=k):(g+T>f&&(g=f-T),g<0&&(g=0),T=Math.min(f-g,s._height)),u.setTranslate(C,p,g),z.on(".drag",null),C.on("wheel",null),s._height<=T||t._context.staticPlot)R.attr({width:v-s.borderwidth,height:T-s.borderwidth,x:s.borderwidth/2,y:s.borderwidth/2}),u.setTranslate(P,0,0),O.select("rect").attr({width:v-2*s.borderwidth,height:T-2*s.borderwidth,x:s.borderwidth,y:s.borderwidth}),u.setClipUrl(P,r,t),u.setRect(z,0,0,0,0),delete s._scrollY;else{var D,F,j=Math.max(d.scrollBarMinHeight,T*T/s._height),B=T-j-2*d.scrollBarMargin,U=s._height-T,V=B/U,H=Math.min(s._scrollY||0,U);R.attr({width:v-2*s.borderwidth+d.scrollBarWidth+d.scrollBarMargin,height:T-s.borderwidth,x:s.borderwidth/2,y:s.borderwidth/2}),O.select("rect").attr({width:v-2*s.borderwidth+d.scrollBarWidth+d.scrollBarMargin,height:T-2*s.borderwidth,x:s.borderwidth,y:s.borderwidth+H}),u.setClipUrl(P,r,t),G(H,j,V),C.on("wheel",function(){G(H=i.constrain(s._scrollY+n.event.deltaY/B*U,0,U),j,V),0!==H&&H!==U&&n.event.preventDefault()});var q=n.behavior.drag().on("dragstart",function(){D=n.event.sourceEvent.clientY,F=H}).on("drag",function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||G(H=i.constrain((t.clientY-D)/V+F,0,U),j,V)});z.call(q)}function G(e,r,n){s._scrollY=t._fullLayout.legend._scrollY=e,u.setTranslate(P,0,-e),u.setRect(z,v,d.scrollBarMargin+e*n,d.scrollBarWidth,r),O.select("rect").attr({y:s.borderwidth+e})}t._context.edits.legendPosition&&(C.classed("cursor-move",!0),l.init({element:C.node(),gd:t,prepFn:function(){var t=u.getTranslate(C);w=t.x,M=t.y},moveFn:function(t,e){var r=w+t,n=M+e;u.setTranslate(C,r,n),x=l.align(r,0,h.l,h.l+h.w,s.xanchor),_=l.align(n,0,h.t+h.h,h.t,s.yanchor)},doneFn:function(){void 0!==x&&void 0!==_&&o.call("_guiRelayout",t,{"legend.x":x,"legend.y":_})},clickFn:function(r,n){var i=e._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return n.clientX>=t.left&&n.clientX<=t.right&&n.clientY>=t.top&&n.clientY<=t.bottom});i.size()>0&&A(t,C,i,r,n)}}))}],t)}}},{"../../constants/alignment":471,"../../constants/interactions":474,"../../lib":495,"../../lib/events":487,"../../lib/svg_text_utils":518,"../../plots/plots":584,"../../registry":592,"../color":376,"../dragelement":394,"../drawing":397,"./constants":426,"./get_legend_data":429,"./handle_click":430,"./helpers":431,"./style":433,d3:81}],429:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./helpers");e.exports=function(t,e){var r,a,o={},s=[],l=!1,u={},c=0;function f(t,r){if(""!==t&&i.isGrouped(e))-1===s.indexOf(t)?(s.push(t),l=!0,o[t]=[[r]]):o[t].push([r]);else{var n="~~i"+c;s.push(n),o[n]=[[r]],c++}}for(r=0;rr[1])return r[1]}return i}function p(t){return t[0]}if(c||f||h){var g={},v={};if(c){g.mc=d("marker.color",p),g.mx=d("marker.symbol",p),g.mo=d("marker.opacity",a.mean,[.2,1]),g.mlc=d("marker.line.color",p),g.mlw=d("marker.line.width",a.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var m=d("marker.size",a.mean,[2,16]);g.ms=m,v.marker.size=m}h&&(v.line={width:d("line.width",p,[0,10])}),f&&(g.tx="Aa",g.tp=d("textposition",p),g.ts=10,g.tc=d("textfont.color",p),g.tf=d("textfont.family",p)),r=[a.minExtend(s,g)],(i=a.minExtend(u,v)).selectedpoints=null}var y=n.select(this).select("g.legendpoints"),b=y.selectAll("path.scatterpts").data(c?r:[]);b.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),b.exit().remove(),b.call(o.pointStyle,i,e),c&&(r[0].mrc=3);var x=y.selectAll("g.pointtext").data(f?r:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(o.textPointStyle,i,e)}).each(function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data("candlestick"===e.type&&e.visible?[t,t]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",function(t,e){return e?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"}).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each(function(t,r){var i=e[r?"increasing":"decreasing"],a=i.line.width,o=n.select(this);o.style("stroke-width",a+"px").call(s.fill,i.fillcolor),a&&s.stroke(o,i.line.color)})}).each(function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data("ohlc"===e.type&&e.visible?[t,t]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",function(t,e){return e?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"}).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each(function(t,r){var i=e[r?"increasing":"decreasing"],a=i.line.width,l=n.select(this);l.style("fill","none").call(o.dashLine,i.line.dash,a),a&&s.stroke(l,i.line.color)})})}},{"../../lib":495,"../../registry":592,"../../traces/pie/style_one":614,"../../traces/scatter/subtypes":640,"../color":376,"../drawing":397,d3:81}],434:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/plots"),a=t("../../plots/cartesian/axis_ids"),o=t("../../lib"),s=t("../../../build/ploticon"),l=o._,u=e.exports={};function c(t,e){var r,i,o=e.currentTarget,s=o.getAttribute("data-attr"),l=o.getAttribute("data-val")||!0,u=t._fullLayout,c={},f=a.list(t,null,!0),h="on";if("zoom"===s){var d,p="in"===l?.5:2,g=(1+p)/2,v=(1-p)/2;for(i=0;i1?(A=["toggleHover"],M=["resetViews"]):h?(w=["zoomInGeo","zoomOutGeo"],A=["hoverClosestGeo"],M=["resetGeo"]):f?(A=["hoverClosest3d"],M=["resetCameraDefault3d","resetCameraLastSave3d"]):v?(A=["toggleHover"],M=["resetViewMapbox"]):A=p?["hoverClosestGl2d"]:d?["hoverClosestPie"]:["toggleHover"];c&&(A=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);!c&&!p||y||(w=["zoomIn2d","zoomOut2d","autoScale2d"],"resetViews"!==M[0]&&(M=["resetScale2d"]));f?T=["zoom3d","pan3d","orbitRotation","tableRotation"]:(c||p)&&!y||g?T=["zoom2d","pan2d"]:v||h?T=["pan2d"]:m&&(T=["zoom2d"]);(function(t){for(var e=!1,r=0;r0)){var g=function(t,e,r){for(var n=r.filter(function(r){return e[r].anchor===t._id}),i=0,a=0;a0?h+u:u;return{ppad:u,ppadplus:c?p:g,ppadminus:c?g:p}}return{ppad:u}}function c(t,e,r,n,i){var s="category"===t.type||"multicategory"===t.type?t.r2c:t.d2c;if(void 0!==e)return[s(e),s(r)];if(n){var l,u,c,f,h=1/0,d=-1/0,p=n.match(a.segmentRE);for("date"===t.type&&(s=o.decodeDate(s)),l=0;ld&&(d=f)));return d>=h?[h,d]:void 0}}e.exports=function(t){var e=t._fullLayout,r=n.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var o=0;o10?t/2:10;return n.append("circle").attr({"data-line-point":"start-point",cx:I?H(r.xanchor)+r.x0:H(r.x0),cy:N?q(r.yanchor)-r.y0:q(r.y0),r:a}).style(i).classed("cursor-grab",!0),n.append("circle").attr({"data-line-point":"end-point",cx:I?H(r.xanchor)+r.x1:H(r.x1),cy:N?q(r.yanchor)-r.y1:q(r.y1),r:a}).style(i).classed("cursor-grab",!0),n}():e,Y={element:W.node(),gd:t,prepFn:function(n){I&&(_=H(r.xanchor));N&&(w=q(r.yanchor));"path"===r.type?O=r.path:(m=I?r.x0:H(r.x0),y=N?r.y0:q(r.y0),b=I?r.x1:H(r.x1),x=N?r.y1:q(r.y1));mx?(A=y,E="y0",M=x,L="y1"):(A=x,E="y1",M=y,L="y0");Z(n),J(d,r),function(t,e,r){var n=e.xref,i=e.yref,o=a.getFromId(r,n),l=a.getFromId(r,i),u="";"paper"===n||o.autorange||(u+=n);"paper"===i||l.autorange||(u+=i);s.setClipUrl(t,u?"clip"+r._fullLayout._uid+u:null,r)}(e,r,t),Y.moveFn="move"===R?Q:$},doneFn:function(){c(e),K(d),p(e,t,r),n.call("_guiRelayout",t,j.getUpdateObj())},clickFn:function(){K(d)}};function Z(t){if(D)R="path"===t.target.tagName?"move":"start-point"===t.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var r=Y.element.getBoundingClientRect(),n=r.right-r.left,i=r.bottom-r.top,a=t.clientX-r.left,o=t.clientY-r.top,s=!F&&n>P&&i>z&&!t.shiftKey?u.getCursor(a/n,1-o/i):"move";c(e,s),R=s.split("-")[0]}}function Q(n,i){if("path"===r.type){var a=function(t){return t},o=a,s=a;I?B("xanchor",r.xanchor=G(_+n)):(o=function(t){return G(H(t)+n)},U&&"date"===U.type&&(o=h.encodeDate(o))),N?B("yanchor",r.yanchor=X(w+i)):(s=function(t){return X(q(t)+i)},V&&"date"===V.type&&(s=h.encodeDate(s))),B("path",r.path=v(O,o,s))}else I?B("xanchor",r.xanchor=G(_+n)):(B("x0",r.x0=G(m+n)),B("x1",r.x1=G(b+n))),N?B("yanchor",r.yanchor=X(w+i)):(B("y0",r.y0=X(y+i)),B("y1",r.y1=X(x+i)));e.attr("d",g(t,r)),J(d,r)}function $(n,i){if(F){var a=function(t){return t},o=a,s=a;I?B("xanchor",r.xanchor=G(_+n)):(o=function(t){return G(H(t)+n)},U&&"date"===U.type&&(o=h.encodeDate(o))),N?B("yanchor",r.yanchor=X(w+i)):(s=function(t){return X(q(t)+i)},V&&"date"===V.type&&(s=h.encodeDate(s))),B("path",r.path=v(O,o,s))}else if(D){if("resize-over-start-point"===R){var l=m+n,u=N?y-i:y+i;B("x0",r.x0=I?l:G(l)),B("y0",r.y0=N?u:X(u))}else if("resize-over-end-point"===R){var c=b+n,f=N?x-i:x+i;B("x1",r.x1=I?c:G(c)),B("y1",r.y1=N?f:X(f))}}else{var p=~R.indexOf("n")?A+i:A,j=~R.indexOf("s")?M+i:M,W=~R.indexOf("w")?T+n:T,Y=~R.indexOf("e")?k+n:k;~R.indexOf("n")&&N&&(p=A-i),~R.indexOf("s")&&N&&(j=M-i),(!N&&j-p>z||N&&p-j>z)&&(B(E,r[E]=N?p:X(p)),B(L,r[L]=N?j:X(j))),Y-W>P&&(B(S,r[S]=I?W:G(W)),B(C,r[C]=I?Y:G(Y)))}e.attr("d",g(t,r)),J(d,r)}function J(t,e){(I||N)&&function(){var r="path"!==e.type,n=t.selectAll(".visual-cue").data([0]);n.enter().append("path").attr({fill:"#fff","fill-rule":"evenodd",stroke:"#000","stroke-width":1}).classed("visual-cue",!0);var a=H(I?e.xanchor:i.midRange(r?[e.x0,e.x1]:h.extractPathCoords(e.path,f.paramIsX))),o=q(N?e.yanchor:i.midRange(r?[e.y0,e.y1]:h.extractPathCoords(e.path,f.paramIsY)));if(a=h.roundPositionForSharpStrokeRendering(a,1),o=h.roundPositionForSharpStrokeRendering(o,1),I&&N){var s="M"+(a-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",s)}else if(I){var l="M"+(a-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",l)}else{var u="M"+(a-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",u)}}()}function K(t){t.selectAll(".visual-cue").remove()}u.init(Y),W.node().onmousemove=Z}(t,b,r,e,d)}}function p(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"");s.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function g(t,e){var r,n,o,s,l,u,c,d,p=e.type,g=a.getFromId(t,e.xref),v=a.getFromId(t,e.yref),m=t._fullLayout._size;if(g?(r=h.shapePositionToRange(g),n=function(t){return g._offset+g.r2p(r(t,!0))}):n=function(t){return m.l+m.w*t},v?(o=h.shapePositionToRange(v),s=function(t){return v._offset+v.r2p(o(t,!0))}):s=function(t){return m.t+m.h*(1-t)},"path"===p)return g&&"date"===g.type&&(n=h.decodeDate(n)),v&&"date"===v.type&&(s=h.decodeDate(s)),function(t,e,r){var n=t.path,a=t.xsizemode,o=t.ysizemode,s=t.xanchor,l=t.yanchor;return n.replace(f.segmentRE,function(t){var n=0,u=t.charAt(0),c=f.paramIsX[u],h=f.paramIsY[u],d=f.numParams[u],p=t.substr(1).replace(f.paramRE,function(t){return c[n]?t="pixel"===a?e(s)+Number(t):e(t):h[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>d&&(t="X"),t});return n>d&&(p=p.replace(/[\s,]*X.*/,""),i.log("Ignoring extra params in segment "+t)),u+p})}(e,n,s);if("pixel"===e.xsizemode){var y=n(e.xanchor);l=y+e.x0,u=y+e.x1}else l=n(e.x0),u=n(e.x1);if("pixel"===e.ysizemode){var b=s(e.yanchor);c=b-e.y0,d=b-e.y1}else c=s(e.y0),d=s(e.y1);if("line"===p)return"M"+l+","+c+"L"+u+","+d;if("rect"===p)return"M"+l+","+c+"H"+u+"V"+d+"H"+l+"Z";var x=(l+u)/2,_=(c+d)/2,w=Math.abs(x-l),A=Math.abs(_-c),M="A"+w+","+A,T=x+w+","+_;return"M"+T+M+" 0 1,1 "+(x+","+(_-A))+M+" 0 0,1 "+T+"Z"}function v(t,e,r){return t.replace(f.segmentRE,function(t){var n=0,i=t.charAt(0),a=f.paramIsX[i],o=f.paramIsY[i],s=f.numParams[i];return i+t.substr(1).replace(f.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}e.exports={draw:function(t){var e=t._fullLayout;for(var r in e._shapeUpperLayer.selectAll("path").remove(),e._shapeLowerLayer.selectAll("path").remove(),e._plots){var n=e._plots[r].shapelayer;n&&n.selectAll("path").remove()}for(var i=0;i0&&(s=s.transition().duration(e.transition.duration).ease(e.transition.easing)),s.attr("transform","translate("+(o-.5*c.gripWidth)+","+e._dims.currentValueTotalHeight+")")}}function E(t,e){var r=t._dims;return r.inputAreaStart+c.stepInset+(r.inputAreaLength-2*c.stepInset)*Math.min(1,Math.max(0,e))}function L(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-c.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*c.stepInset-2*r.inputAreaStart)))}function S(t,e,r){var n=r._dims,i=s.ensureSingle(t,"rect",c.railTouchRectClass,function(n){n.call(M,e,t,r).style("pointer-events","all")});i.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,c.tickOffset+r.ticklen+n.labelHeight)}).call(a.fill,r.bgcolor).attr("opacity",0),o.setTranslate(i,0,n.currentValueTotalHeight)}function C(t,e){var r=e._dims,n=r.inputAreaLength-2*c.railInset,i=s.ensureSingle(t,"rect",c.railRectClass);i.attr({width:n,height:c.railWidth,rx:c.railRadius,ry:c.railRadius,"shape-rendering":"crispEdges"}).call(a.stroke,e.bordercolor).call(a.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(i,c.railInset,.5*(r.inputAreaWidth-c.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[c.name],n=[],i=0;i0?[0]:[]);function s(e){e._commandObserver&&(e._commandObserver.remove(),delete e._commandObserver),i.autoMargin(t,g(e))}if(a.enter().append("g").classed(c.containerClassName,!0).style("cursor","ew-resize"),a.exit().each(function(){n.select(this).selectAll("g."+c.groupClassName).each(s)}).remove(),0!==r.length){var l=a.selectAll("g."+c.groupClassName).data(r,v);l.enter().append("g").classed(c.groupClassName,!0),l.exit().each(s).remove();for(var u=0;u0||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[y.side];e.attr("transform","translate("+g+")")}}}P.call(z),O&&(k?P.on(".opacity",null):(A=0,M=!0,P.text(v).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})),P.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==m?o.call("_guiRestyle",t,g,e,m):o.call("_guiRelayout",t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(z)}).on("input",function(t){this.text(t||" ").call(c.positionText,b.x,b.y)}));return P.classed("js-placeholder",M),_}};var h=/ [XY][0-9]* /},{"../../constants/interactions":474,"../../lib":495,"../../lib/svg_text_utils":518,"../../plots/plots":584,"../../registry":592,"../color":376,"../drawing":397,d3:81,"fast-isnumeric":90}],465:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plot_api/edit_types").overrideAll,s=t("../../plots/pad_attributes"),l=t("../../plot_api/plot_template").templatedArray,u=l("button",{visible:{valType:"boolean"},method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});e.exports=o(l("updatemenu",{_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:u,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},pad:a(s({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":488,"../../plot_api/edit_types":524,"../../plot_api/plot_template":531,"../../plots/font_attributes":567,"../../plots/pad_attributes":583,"../color/attributes":375}],466:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],467:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/array_container_defaults"),a=t("./attributes"),o=t("./constants").name,s=a.buttons;function l(t,e,r){function o(r,i){return n.coerce(t,e,a,r,i)}o("visible",i(t,e,{name:"buttons",handleItemDefaults:u}).length>0)&&(o("active"),o("direction"),o("type"),o("showactive"),o("x"),o("y"),n.noneOrAll(t,e,["x","y"]),o("xanchor"),o("yanchor"),o("pad.t"),o("pad.r"),o("pad.b"),o("pad.l"),n.coerceFont(o,"font",r.font),o("bgcolor",r.paper_bgcolor),o("bordercolor"),o("borderwidth"))}function u(t,e){function r(r,i){return n.coerce(t,e,s,r,i)}r("visible","skip"===t.method||Array.isArray(t.args))&&(r("method"),r("args"),r("label"),r("execute"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":495,"../../plots/array_container_defaults":537,"./attributes":465,"./constants":466}],468:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plots/plots"),a=t("../color"),o=t("../drawing"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),u=t("../../plot_api/plot_template").arrayEditor,c=t("../../constants/alignment").LINE_SPACING,f=t("./constants"),h=t("./scrollbox");function d(t){return t._index}function p(t,e){return+t.attr(f.menuIndexAttrName)===e._index}function g(t,e,r,n,i,a,o,s){e.active=o,u(t.layout,f.name,e).applyUpdate("active",o),"buttons"===e.type?m(t,n,null,null,e):"dropdown"===e.type&&(i.attr(f.menuIndexAttrName,"-1"),v(t,n,i,a,e),s||m(t,n,i,a,e))}function v(t,e,r,n,i){var a=s.ensureSingle(e,"g",f.headerClassName,function(t){t.style("pointer-events","all")}),l=i._dims,u=i.active,c=i.buttons[u]||f.blankHeaderOpts,h={y:i.pad.t,yPad:0,x:i.pad.l,xPad:0,index:0},d={width:l.headerWidth,height:l.headerHeight};a.call(y,i,c,t).call(k,i,h,d),s.ensureSingle(e,"text",f.headerArrowClassName,function(t){t.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,i.font).text(f.arrowSymbol[i.direction])}).attr({x:l.headerWidth-f.arrowOffsetX+i.pad.l,y:l.headerHeight/2+f.textOffsetY+i.pad.t}),a.on("click",function(){r.call(E,String(p(r,i)?-1:i._index)),m(t,e,r,n,i)}),a.on("mouseover",function(){a.call(w)}),a.on("mouseout",function(){a.call(A,i)}),o.setTranslate(e,l.lx,l.ly)}function m(t,e,r,a,o){r||(r=e).attr("pointer-events","all");var l=function(t){return-1==+t.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,u="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,c=r.selectAll("g."+u).data(s.filterVisible(l)),h=c.enter().append("g").classed(u,!0),d=c.exit();"dropdown"===o.type?(h.attr("opacity","0").transition().attr("opacity","1"),d.transition().attr("opacity","0").remove()):d.remove();var p=0,v=0,m=o._dims,b=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(b?v=m.headerHeight+f.gapButtonHeader:p=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(p=-f.gapButtonHeader+f.gapButton-m.openWidth);var x={x:m.lx+p+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},M={l:x.x+o.borderwidth,t:x.y+o.borderwidth};c.each(function(s,l){var u=n.select(this);u.call(y,o,s,t).call(k,o,x),u.on("click",function(){n.event.defaultPrevented||(g(t,o,0,e,r,a,l),s.execute&&i.executeAPICommand(t,s.method,s.args),t.emit("plotly_buttonclicked",{menu:o,button:s,active:o.active}))}),u.on("mouseover",function(){u.call(w)}),u.on("mouseout",function(){u.call(A,o),c.call(_,o)})}),c.call(_,o),b?(M.w=Math.max(m.openWidth,m.headerWidth),M.h=x.y-M.t):(M.w=x.x-M.l,M.h=Math.max(m.openHeight,m.headerHeight)),M.direction=o.direction,a&&(c.size()?function(t,e,r,n,i,a){var o,s,l,u=i.direction,c="up"===u||"down"===u,h=i._dims,d=i.active;if(c)for(s=0,l=0;l0?[0]:[]);if(o.enter().append("g").classed(f.containerClassName,!0).style("cursor","pointer"),o.exit().each(function(){n.select(this).selectAll("g."+f.headerGroupClassName).each(a)}).remove(),0!==r.length){var l=o.selectAll("g."+f.headerGroupClassName).data(r,d);l.enter().append("g").classed(f.headerGroupClassName,!0);for(var u=s.ensureSingle(o,"g",f.dropdownButtonGroupClassName,function(t){t.style("pointer-events","all")}),c=0;cw,T=s.barLength+2*s.barPad,k=s.barWidth+2*s.barPad,E=p,L=v+m;L+k>u&&(L=u-k);var S=this.container.selectAll("rect.scrollbar-horizontal").data(M?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,s.barColor),M?(this.hbar=S.attr({rx:s.barRadius,ry:s.barRadius,x:E,y:L,width:T,height:k}),this._hbarXMin=E+T/2,this._hbarTranslateMax=w-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var C=m>A,O=s.barWidth+2*s.barPad,R=s.barLength+2*s.barPad,P=p+g,z=v;P+O>l&&(P=l-O);var I=this.container.selectAll("rect.scrollbar-vertical").data(C?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,s.barColor),C?(this.vbar=I.attr({rx:s.barRadius,ry:s.barRadius,x:P,y:z,width:O,height:R}),this._vbarYMin=z+R/2,this._vbarTranslateMax=A-R):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var N=this.id,D=c-.5,F=C?f+O+.5:f+.5,j=h-.5,B=M?d+k+.5:d+.5,U=o._topdefs.selectAll("#"+N).data(M||C?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",N).append("rect"),M||C?(this._clipRect=U.select("rect").attr({x:Math.floor(D),y:Math.floor(j),width:Math.ceil(F)-Math.floor(D),height:Math.ceil(B)-Math.floor(j)}),this.container.call(a.setClipUrl,N,this.gd),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(a.setClipUrl,null),delete this._clipRect),M||C){var V=n.behavior.drag().on("dragstart",function(){n.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var H=n.behavior.drag().on("dragstart",function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));M&&this.hbar.on(".drag",null).call(H),C&&this.vbar.on(".drag",null).call(H)}this.setTranslate(e,r)},s.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(a.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},s.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=n.event.dx),this.vbar&&(e-=n.event.dy),this.setTranslate(t,e)},s.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=n.event.deltaY),this.vbar&&(e+=n.event.deltaY),this.setTranslate(t,e)},s.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,i=r+this._hbarTranslateMax;t=(o.constrain(n.event.x,r,i)-r)/(i-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,s=a+this._vbarTranslateMax;e=(o.constrain(n.event.y,a,s)-a)/(s-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},s.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=o.constrain(t||0,0,r),e=o.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(a.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(a.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var s=e/n;this.vbar.call(a.setTranslate,t,e+s*this._vbarTranslateMax)}}},{"../../lib":495,"../color":376,"../drawing":397,d3:81}],471:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},FROM_BR:{left:1,center:.5,right:0,bottom:0,middle:.5,top:1},LINE_SPACING:1.3,CAP_SHIFT:.7,MID_SHIFT:.35,OPPOSITE_SIDE:{left:"right",right:"left",top:"bottom",bottom:"top"}}},{}],472:[function(t,e,r){"use strict";e.exports={solid:[[],0],dot:[[.5,1],200],dash:[[.5,1],50],longdash:[[.5,1],10],dashdot:[[.5,.625,.875,1],50],longdashdot:[[.5,.7,.8,1],10]}},{}],473:[function(t,e,r){"use strict";e.exports={circle:"\u25cf","circle-open":"\u25cb",square:"\u25a0","square-open":"\u25a1",diamond:"\u25c6","diamond-open":"\u25c7",cross:"+",x:"\u274c"}},{}],474:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],475:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],476:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],477:[function(t,e,r){"use strict";r.version="1.46.1",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config")();for(var n=t("./registry"),i=r.register=n.register,a=t("./plot_api"),o=Object.keys(a),s=0;s1/3&&t.x<2/3},r.isRightAnchor=function(t){return"right"===t.xanchor||"auto"===t.xanchor&&t.x>=2/3},r.isTopAnchor=function(t){return"top"===t.yanchor||"auto"===t.yanchor&&t.y>=2/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3}},{}],480:[function(t,e,r){"use strict";var n=t("./mod"),i=n.mod,a=n.modHalf,o=Math.PI,s=2*o;function l(t){return Math.abs(t[1]-t[0])>s-1e-14}function u(t,e){return a(e-t,s)}function c(t,e){if(l(e))return!0;var r,n;e[0](n=i(n,s))&&(n+=s);var a=i(t,s),o=a+s;return a>=r&&a<=n||o>=r&&o<=n}function f(t,e,r,n,i,a,u){i=i||0,a=a||0;var c,f,h,d,p,g=l([r,n]);function v(t,e){return[t*Math.cos(e)+i,a-t*Math.sin(e)]}g?(c=0,f=o,h=s):r=i&&t<=a);var i,a},pathArc:function(t,e,r,n,i){return f(null,t,e,r,n,i,0)},pathSector:function(t,e,r,n,i){return f(null,t,e,r,n,i,1)},pathAnnulus:function(t,e,r,n,i,a){return f(t,e,r,n,i,a,1)}}},{"./mod":502}],481:[function(t,e,r){"use strict";var n=Array.isArray,i="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},a="undefined"==typeof DataView?function(){}:DataView;function o(t){return i.isView(t)&&!(t instanceof a)}function s(t){return n(t)||o(t)}function l(t,e,r){if(s(t)){if(s(t[0])){for(var n=r,i=0;ii.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;!0!==n.strict&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every(function(t){return i(t).isValid()})?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(o.get(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?e.set(c(+t,360)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r,n){var i=n.regex||u(r);"string"==typeof t&&i.test(t)?e.set(t):e.set(r)},validateFunction:function(t,e){var r=e.dflt;return t===r||"string"==typeof t&&!!u(r).test(t)}},flaglist:{coerceFunction:function(t,e,r,n){if("string"==typeof t)if(-1===(n.extras||[]).indexOf(t)){for(var i=t.split("+"),a=0;a=n&&t<=i?t:c}if("string"!=typeof t&&"number"!=typeof t)return c;t=String(t);var u=_(e),m=t.charAt(0);!u||"G"!==m&&"g"!==m||(t=t.substr(1),e="");var w=u&&"chinese"===e.substr(0,7),A=t.match(w?b:y);if(!A)return c;var M=A[1],T=A[3]||"1",k=Number(A[5]||1),E=Number(A[7]||0),L=Number(A[9]||0),S=Number(A[11]||0);if(u){if(2===M.length)return c;var C;M=Number(M);try{var O=v.getComponentMethod("calendars","getCal")(e);if(w){var R="i"===T.charAt(T.length-1);T=parseInt(T,10),C=O.newDate(M,O.toMonthIndex(M,T,R),k)}else C=O.newDate(M,Number(T),k)}catch(t){return c}return C?(C.toJD()-g)*f+E*h+L*d+S*p:c}M=2===M.length?(Number(M)+2e3-x)%100+x:Number(M),T-=1;var P=new Date(Date.UTC(2e3,T,k,E,L));return P.setUTCFullYear(M),P.getUTCMonth()!==T?c:P.getUTCDate()!==k?c:P.getTime()+S*p},n=r.MIN_MS=r.dateTime2ms("-9999"),i=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==c};var A=90*f,M=3*h,T=5*d;function k(t,e,r,n,i){if((e||r||n||i)&&(t+=" "+w(e,2)+":"+w(r,2),(n||i)&&(t+=":"+w(n,2),i))){for(var a=4;i%10==0;)a-=1,i/=10;t+="."+w(i,a)}return t}r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=n&&t<=i))return c;e||(e=0);var a,o,s,u,y,b,x=Math.floor(10*l(t+.05,1)),w=Math.round(t-x/10);if(_(r)){var E=Math.floor(w/f)+g,L=Math.floor(l(t,f));try{a=v.getComponentMethod("calendars","getCal")(r).fromJD(E).formatDate("yyyy-mm-dd")}catch(t){a=m("G%Y-%m-%d")(new Date(w))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;o=e=n+f&&t<=i-f))return c;var e=Math.floor(10*l(t+.05,1)),r=new Date(Math.round(t-e/10));return k(a.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,n){if(t===c)return e;if(r.isJSDate(t)||"number"==typeof t&&isFinite(t)){if(_(n))return s.error("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,n))return s.error("unrecognized date",t),e;return t};var E=/%\d?f/g;function L(t,e,r,n){t=t.replace(E,function(t){var r=Math.min(+t.charAt(1)||6,6);return(e/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"});var i=new Date(Math.floor(e+.05));if(_(n))try{t=v.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(i)}var S=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(t,e,r,n,i,a){if(i=_(i)&&i,!e)if("y"===r)e=a.year;else if("m"===r)e=a.month;else{if("d"!==r)return function(t,e){var r=l(t+.05,f),n=w(Math.floor(r/h),2)+":"+w(l(Math.floor(r/d),60),2);if("M"!==e){o(e)||(e=0);var i=(100+Math.min(l(t/p,60),S[e])).toFixed(e).substr(1);e>0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}(t,r)+"\n"+L(a.dayMonthYear,t,n,i);e=a.dayMonth+"\n"+a.year}return L(e,t,n,i)};var C=3*f;r.incrementMonth=function(t,e,r){r=_(r)&&r;var n=l(t,f);if(t=Math.round(t-n),r)try{var i=Math.round(t/f)+g,a=v.getComponentMethod("calendars","getCal")(r),o=a.fromJD(i);return e%12?a.add(o,e,"m"):a.add(o,e/12,"y"),(o.toJD()-g)*f+n}catch(e){s.error("invalid ms "+t+" in calendar "+r)}var u=new Date(t+C);return u.setUTCMonth(u.getUTCMonth()+e)+n-C},r.findExactDates=function(t,e){for(var r,n,i=0,a=0,s=0,l=0,u=_(e)&&v.getComponentMethod("calendars","getCal")(e),c=0;c1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}function l(t,e,r,n,i){var a=n*t+i*e;if(a<0)return n*n+i*i;if(a>r){var o=n-t,s=i-e;return o*o+s*s}var l=n*e-i*t;return l*l/r}r.segmentsIntersect=s,r.segmentDistance=function(t,e,r,n,i,a,o,u){if(s(t,e,r,n,i,a,o,u))return 0;var c=r-t,f=n-e,h=o-i,d=u-a,p=c*c+f*f,g=h*h+d*d,v=Math.min(l(c,f,p,i-t,a-e),l(c,f,p,o-t,u-e),l(h,d,g,t-i,e-a),l(h,d,g,r-i,n-a));return Math.sqrt(v)},r.getTextLocation=function(t,e,r,s){if(t===i&&s===a||(n={},i=t,a=s),n[r])return n[r];var l=t.getPointAtLength(o(r-s/2,e)),u=t.getPointAtLength(o(r+s/2,e)),c=Math.atan((u.y-l.y)/(u.x-l.x)),f=t.getPointAtLength(o(r,e)),h={x:(4*f.x+l.x+u.x)/6,y:(4*f.y+l.y+u.y)/6,theta:c};return n[r]=h,h},r.clearLocationCache=function(){i=null},r.getVisibleSegment=function(t,e,r){var n,i,a=e.left,o=e.right,s=e.top,l=e.bottom,u=0,c=t.getTotalLength(),f=c;function h(e){var r=t.getPointAtLength(e);0===e?n=r:e===c&&(i=r);var u=r.xo?r.x-o:0,f=r.yl?r.y-l:0;return Math.sqrt(u*u+f*f)}for(var d=h(u);d;){if((u+=d+r)>f)return;d=h(u)}for(d=h(f);d;){if(u>(f-=d+r))return;d=h(f)}return{min:u,max:f,len:f-u,total:c,isClosed:0===u&&f===c&&Math.abs(n.x-i.x)<.1&&Math.abs(n.y-i.y)<.1}},r.findPointOnPath=function(t,e,r,n){for(var i,a,o,s=(n=n||{}).pathLength||t.getTotalLength(),l=n.tolerance||.001,u=n.iterationLimit||30,c=t.getPointAtLength(0)[r]>t.getPointAtLength(s)[r]?-1:1,f=0,h=0,d=s;f0?d=i:h=i,f++}return a}},{"./mod":502}],492:[function(t,e,r){"use strict";e.exports=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null==t)throw new Error("DOM element provided is null or undefined");return t}},{}],493:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("color-normalize"),o=t("../components/colorscale"),s=t("../components/color/attributes").defaultLine,l=t("./array").isArrayOrTypedArray,u=a(s),c=1;function f(t,e){var r=t;return r[3]*=e,r}function h(t){if(n(t))return u;var e=a(t);return e.length?e:u}function d(t){return n(t)?t:c}e.exports={formatColor:function(t,e,r){var n,i,s,p,g,v=t.color,m=l(v),y=l(e),b=[];if(n=void 0!==t.colorscale?o.makeColorScaleFunc(o.extractScale(t,{cLetter:"c"})):h,i=m?function(t,e){return void 0===t[e]?u:a(n(t[e]))}:h,s=y?function(t,e){return void 0===t[e]?c:d(t[e])}:d,m||y)for(var x=0;xo?s:i(t)?Number(t):s:s},l.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(i(t)&&t>=0&&t%1==0)},l.noop=t("./noop"),l.identity=t("./identity"),l.repeat=function(t,e){for(var r=new Array(e),n=0;nr?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o=Math.pow(2,r)?i>10?(l.warn("randstr failed uniqueness"),u):t(e,r,n,(i||0)+1):u},l.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={optionList:[],_newoption:function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)}};return r["_"+e]=t,r},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;r=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[n];c[r]=a}return c},l.syncOrAsync=function(t,e,r){var n;function i(){return l.syncOrAsync(t,e,r)}for(;t.length;)if((n=(0,t.splice(0,1)[0])(e))&&n.then)return n.then(i).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,i=!1,a=!0;for(n=0;n1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l},l.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)(:[^}]*)?}/g;var k=/^\w*$/;l.templateString=function(t,e){var r={};return t.replace(l.TEMPLATE_STRING_REGEX,function(t,n){return k.test(n)?e[n]||"":(r[n]=r[n]||l.nestedProperty(e,n).get,r[n]()||"")})};var E=/^:/,L=0;l.hovertemplateString=function(t,e,r){var i=arguments,a={};return t.replace(l.TEMPLATE_STRING_REGEX,function(t,o,s){var u,c,f;for(f=3;f=48&&o<=57,u=s>=48&&s<=57;if(l&&(n=10*n+o-48),u&&(i=10*i+s-48),!l||!u){if(n!==i)return n-i;if(o!==s)return o-s}}return i-n};var S=2e9;l.seedPseudoRandom=function(){S=2e9},l.pseudoRandom=function(){var t=S;return S=(69069*S+1)%4294967296,Math.abs(S-t)<429496729?l.pseudoRandom():S/4294967296}},{"../constants/numerical":475,"./anchor_utils":479,"./angles":480,"./array":481,"./clean_number":482,"./clear_responsive":484,"./coerce":485,"./dates":486,"./extend":488,"./filter_unique":489,"./filter_visible":490,"./geometry2d":491,"./get_graph_div":492,"./identity":494,"./is_plain_object":496,"./keyed_container":497,"./localize":498,"./loggers":499,"./make_trace_groups":500,"./matrix":501,"./mod":502,"./nested_property":503,"./noop":504,"./notifier":505,"./push_unique":508,"./regex":510,"./relative_attr":511,"./relink_private":512,"./search":513,"./stats":516,"./throttle":519,"./to_log_range":520,d3:81,"fast-isnumeric":90}],496:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],497:[function(t,e,r){"use strict";var n=t("./nested_property"),i=/^\w*$/;e.exports=function(t,e,r,a){var o,s,l;r=r||"name",a=a||"value";var u={};e&&e.length?(l=n(t,e),s=l.get()):s=t,e=e||"";var c={};if(s)for(o=0;o2)return u[e]=2|u[e],h.set(t,null);if(f){for(o=e;o1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;ee/2?t-Math.round(t/e)*e:t}}},{}],503:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./array").isArrayOrTypedArray;e.exports=function(t,e){if(n(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,a,o,l=0,u=e.split(".");l/g),o=0;oa||u===i||us||e&&l(t))}:function(t,e){var l=t[0],u=t[1];if(l===i||la||u===i||us)return!1;var c,f,h,d,p,g=r.length,v=r[0][0],m=r[0][1],y=0;for(c=1;cMath.max(f,v)||u>Math.max(h,m)))if(uc||Math.abs(n(o,h))>i)return!0;return!1};a.filter=function(t,e){var r=[t[0]],n=0,i=0;function a(a){t.push(a);var s=r.length,l=n;r.splice(i+1);for(var u=l+1;u1&&a(t.pop());return{addPt:a,raw:t,filtered:r}}},{"../constants/numerical":475,"./matrix":501}],508:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){for(var r=e.toString(),n=0;ni.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--))},startSequence:function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},stopSequence:function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},undo:function(t){var e,r;if(t.framework&&t.framework.isPolar)t.framework.undo();else if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function u(t,e){return t>=e}r.findBin=function(t,e,r){if(n(e.start))return r?Math.ceil((t-e.start)/e.size-1e-9)-1:Math.floor((t-e.start)/e.size+1e-9);var a,c,f=0,h=e.length,d=0,p=h>1?(e[h-1]-e[0])/(h-1):1;for(c=p>=0?r?o:s:r?u:l,t+=1e-9*p*(r?-1:1)*(p>=0?1:-1);f90&&i.log("Long binary search..."),f-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,a=i/(n||1)/1e4,o=[e[0]],s=0;se[s]+a&&(i=Math.min(i,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;i0&&(n=1),r&&n)return t.sort(e)}return n?t:t.reverse()},r.findIndexOfMin=function(t,e){e=e||a;for(var r,n=1/0,i=0;ia.length)&&(o=a.length),n(e)||(e=!1),i(a[0])){for(l=new Array(o),s=0;st.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"./array":481,"fast-isnumeric":90}],517:[function(t,e,r){"use strict";var n=t("color-normalize");e.exports=function(t){return t?n(t):[0,0,0,1]}},{"color-normalize":62}],518:[function(t,e,r){"use strict";var n=t("d3"),i=t("../lib"),a=t("../constants/xmlns_namespaces"),o=t("../constants/alignment").LINE_SPACING;function s(t,e){return t.node().getBoundingClientRect()[e]}var l=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,k){var E=t.text(),S=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&E.match(l),C=n.select(t.node().parentNode);if(!C.empty()){var O=t.attr("class")?t.attr("class").split(" ")[0]:"text";return O+="-math",C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove(),t.style("display",null).attr({"data-unformatted":E,"data-math":"N"}),S?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),a={fontSize:r};!function(t,e,r){var a,o,s,l;MathJax.Hub.Queue(function(){return o=i.extendDeepAll({},MathJax.Hub.config),s=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})},function(){if("SVG"!==(a=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")},function(){var r="math-output-"+i.randstr({},64);return l=n.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(t.replace(u,"\\lt ").replace(c,"\\gt ")),MathJax.Hub.Typeset(l.node())},function(){var e=n.select("body").select("#MathJax_SVG_glyphs");if(l.select(".MathJax_SVG").empty()||!l.select("svg").node())i.log("There was an error in the tex syntax.",t),r();else{var o=l.select("svg").node().getBoundingClientRect();r(l.select(".MathJax_SVG"),e,o)}if(l.remove(),"SVG"!==a)return MathJax.Hub.setRenderer(a)},function(){return void 0!==s&&(MathJax.Hub.processSectionDelay=s),MathJax.Hub.Config(o)})}(S[2],a,function(n,i,a){C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return R(),void e();var l=C.append("g").classed(O+"-group",!0).attr({"pointer-events":"none","data-unformatted":E,"data-math":"Y"});l.node().appendChild(o.node()),i&&i.node()&&o.node().insertBefore(i.node().cloneNode(!0),o.node().firstChild),o.attr({class:O,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=t.node().style.fill||"black";o.select("g").attr({fill:u,stroke:u});var c=s(o,"width"),f=s(o,"height"),h=+t.attr("x")-c*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],d=-(r||s(t,"height"))/4;"y"===O[0]?(l.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-c/2,d-f/2]+")"}),o.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===O[0]?o.attr({x:t.attr("x"),y:d-f/2}):"a"===O[0]&&0!==O.indexOf("atitle")?o.attr({x:0,y:d}):o.attr({x:h,y:+t.attr("y")+d-f/2}),k&&k.call(t,l),e(l)})})):R(),t}function R(){C.empty()||(O=t.attr("class")+"-math",C.select("svg."+O).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(v," ");var r,s=!1,l=[],u=-1;function c(){u++;var e=document.createElementNS(a.svg,"tspan");n.select(e).attr({class:"line",dy:u*o+"em"}),t.appendChild(e),r=e;var i=l;if(l=[{node:e}],i.length>1)for(var s=1;s doesnt match end tag <"+t+">. Pretending it did match.",e),r=l[l.length-1].node}else i.log("Ignoring unexpected end tag .",e)}b.test(e)?c():(r=t,l=[{node:t}]);for(var C=e.split(m),O=0;O|>|>)/g;var f={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},h={sub:"0.3em",sup:"-0.6em"},d={sub:"-0.21em",sup:"0.42em"},p="\u200b",g=["http:","https:","mailto:","",void 0,":"],v=/(\r\n?|\n)/g,m=/(<[^<>]*>)/,y=/<(\/?)([^ >]*)(\s+(.*))?>/i,b=//i,x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,_=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,w=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,A=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function M(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&L(n)}var T=/(^|;)\s*color:/;r.plainText=function(t,e){for(var r=void 0!==(e=e||{}).len&&-1!==e.len?e.len:1/0,n=void 0!==e.allowedTags?e.allowedTags:["br"],i="...".length,a=t.split(m),o=[],s="",l=0,u=0;ui?o.push(c.substr(0,p-i)+"..."):o.push(c.substr(0,p));break}s=""}}return o.join("")};var k={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},E=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function L(t){return t.replace(E,function(t,e){return("#"===e.charAt(0)?function(t){if(t>1114111)return;var e=String.fromCodePoint;if(e)return e(t);var r=String.fromCharCode;return t<=65535?r(t):r(55232+(t>>10),t%1024+56320)}("x"===e.charAt(1)?parseInt(e.substr(2),16):parseInt(e.substr(1),10)):k[e])||t})}function S(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-n.width}:"center"===o?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}r.convertEntities=L,r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){var t=n.select(this);function i(e,r){return void 0===r?null===(r=t.attr(e))&&(t.attr(e,0),r=0):t.attr(e,r),r}var a=i("x",e),o=i("y",r);"text"===this.nodeName&&t.selectAll("tspan.line").attr({x:a,y:o})})},r.makeEditable=function(t,e){var r=e.gd,i=e.delegate,a=n.dispatch("edit","input","cancel"),o=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");function s(){!function(){var i=n.select(r).select(".svg-container"),o=i.append("div"),s=t.node().style,u=parseFloat(s.fontSize||12),c=e.text;void 0===c&&(c=t.attr("data-unformatted"));o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":s.fontFamily||"Arial","font-size":u,color:e.fill||s.fill||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-u/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(c).call(S(t,i,e)).on("blur",function(){r._editing=!1,t.text(this.textContent).style({opacity:1});var e,i=n.select(this).attr("class");(e=i?"."+i.split(" ")[0]+"-math-group":"[class*=-math-group]")&&n.select(t.node().parentNode).select(e).style({opacity:0});var o=this.textContent;n.select(this).transition().duration(0).remove(),n.select(document).on("mouseup",null),a.edit.call(t,o)}).on("focus",function(){var t=this;r._editing=!0,n.select(document).on("mouseup",function(){if(n.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===n.event.which?(r._editing=!1,t.style({opacity:1}),n.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),a.cancel.call(t,this.textContent)):(a.input.call(t,this.textContent),n.select(this).call(S(t,i,e)))}).on("keydown",function(){13===n.event.which&&this.blur()}).call(l)}(),t.style({opacity:0});var i,s=o.attr("class");(i=s?"."+s.split(" ")[0]+"-math-group":"[class*=-math-group]")&&n.select(t.node().parentNode).select(i).style({opacity:0})}function l(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}return e.immediate?s():o.on("click",s),n.rebind(t,a,"on")}},{"../constants/alignment":471,"../constants/xmlns_namespaces":476,"../lib":495,d3:81}],519:[function(t,e,r){"use strict";var n={};function i(t){t&&null!==t.timer&&(clearTimeout(t.timer),t.timer=null)}r.throttle=function(t,e,r){var a=n[t],o=Date.now();if(!a){for(var s in n)n[s].tsa.ts+e?l():a.timer=setTimeout(function(){l(),a.timer=null},e)},r.done=function(t){var e=n[t];return e&&e.timer?new Promise(function(t){var r=e.onDone;e.onDone=function(){r&&r(),t(),e.onDone=null}}):Promise.resolve()},r.clear=function(t){if(t)i(n[t]),delete n[t];else for(var e in n)r.clear(e)}},{}],520:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":90}],521:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],522:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en",dictionary:{"Click to enter Colorscale title":"Click to enter Colourscale title"},format:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],periods:["AM","PM"],dateTime:"%a %b %e %X %Y",date:"%d/%m/%Y",time:"%H:%M:%S",decimal:".",thousands:",",grouping:[3],currency:["$",""],year:"%Y",month:"%b %Y",dayMonth:"%b %-d",dayMonthYear:"%b %-d, %Y"}}},{}],523:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,i=n.layoutArrayContainers,a=n.layoutArrayRegexes,o=t.split("[")[0],s=0;s0&&o.log("Clearing previous rejected promises from queue."),t._promises=[]},r.cleanLayout=function(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var a=(s.subplotsRegistry.cartesian||{}).attrRegex,l=(s.subplotsRegistry.polar||{}).attrRegex,f=(s.subplotsRegistry.ternary||{}).attrRegex,h=(s.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(t);for(e=0;e3?(O.x=1.02,O.xanchor="left"):O.x<-2&&(O.x=-.02,O.xanchor="right"),O.y>3?(O.y=1.02,O.yanchor="bottom"):O.y<-2&&(O.y=-.02,O.yanchor="top")),p(t),"rotate"===t.dragmode&&(t.dragmode="orbit"),u.clean(t),t.template&&t.template.layout&&r.cleanLayout(t.template.layout),t},r.cleanData=function(t){for(var e=0;e0)return t.substr(0,e)}r.hasParent=function(t,e){for(var r=x(e);r;){if(r in t)return!0;r=x(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n1&&a.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return a.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(v,m),d(t),!0)}var b,x,_,w,A,M,T,k,E=Object.keys(r).map(Number).sort(o),L=e.get(),S=L||[],C=c(m,f).get(),O=[],R=-1,P=S.length;for(b=0;bS.length-(T?0:1))a.warn("index out of range",f,_);else if(void 0!==M)A.length>1&&a.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?O.push(_):T?("add"===M&&(M={}),S.splice(_,0,M),C&&C.splice(_,0,{})):a.warn("Unrecognized full object edit value",f,_,M),-1===R&&(R=_);else for(x=0;x=0;b--)S.splice(O[b],1),C&&C.splice(O[b],1);if(S.length?L||e.set(S):e.set(null),g)return!1;if(h(v,m),p!==i){var z;if(-1===R)z=E;else{for(P=Math.max(S.length,P),z=[],b=0;b=R);b++)z.push(_);for(b=R;b=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||i<0&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function I(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),z(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&z(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function N(t,e,r,n,a){!function(t,e,r,n){var i=o.isPlainObject(n);if(!Array.isArray(t.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(e))throw new Error("update must be a key:value object");if("undefined"==typeof r)throw new Error("indices must be an integer or array of integers");for(var a in z(t,r,"indices"),e){if(!Array.isArray(e[a])||e[a].length!==r.length)throw new Error("attribute "+a+" must be an array of length equal to indices array length");if(i&&(!(a in n)||!Array.isArray(n[a])||n[a].length!==e[a].length))throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object")}}(t,e,r,n);for(var l=function(t,e,r,n){var a,l,u,c,f,h=o.isPlainObject(n),d=[];for(var p in Array.isArray(r)||(r=[r]),r=P(r,t.data.length-1),e)for(var g=0;g-1?l(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?l(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?l(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&l(r,r.replace("titleoffset","title.offset")):l(r,r.replace("title","title.text"));function l(e,r){t[r]=t[e],delete t[e]}}function q(t,e,r){if(t=o.getGraphDiv(t),M.clearPromiseQueue(t),t.framework&&t.framework.isPolar)return Promise.resolve(t);var n={};if("string"==typeof e)n[e]=r;else{if(!o.isPlainObject(e))return o.warn("Relayout fail.",e,r),Promise.reject();n=o.extendFlat({},e)}Object.keys(n).length&&(t.changed=!0);var i=Q(t,n),a=i.flags;a.calc&&(t.calcdata=void 0);var s=[h.previousPromises];a.layoutReplot?s.push(T.layoutReplot):Object.keys(n).length&&(G(t,a,i)||h.supplyDefaults(t),a.legend&&s.push(T.doLegend),a.layoutstyle&&s.push(T.layoutStyles),a.axrange&&X(s,i.rangesAltered),a.ticks&&s.push(T.doTicksRelayout),a.modebar&&s.push(T.doModeBar),a.camera&&s.push(T.doCamera),s.push(S)),s.push(h.rehover),u.add(t,q,[t,i.undoit],q,[t,i.redoit]);var l=o.syncOrAsync(s,t);return l&&l.then||(l=Promise.resolve(t)),l.then(function(){return t.emit("plotly_relayout",i.eventData),t})}function G(t,e,r){var n=t._fullLayout;if(!e.axrange)return!1;for(var i in e)if("axrange"!==i&&e[i])return!1;for(var a in r.rangesAltered){var o=p.id2name(a),s=t.layout[o],l=n[o];if(l.autorange=s.autorange,l.range=s.range.slice(),l.cleanRange(),l._matchGroup)for(var u in l._matchGroup)if(u!==a){var c=n[p.id2name(u)];c.autorange=l.autorange,c.range=l.range.slice(),c._input.range=l.range.slice()}}return!0}function X(t,e){var r=e?function(t){var r=[],n=!0;for(var i in e){var a=p.getFromId(t,i);if(r.push(i),a._matchGroup)for(var o in a._matchGroup)e[o]||r.push(o);a.automargin&&(n=!1)}return p.draw(t,r,{skipTitle:n})}:function(t){return p.draw(t,"redraw")};t.push(function(t){var e=t._fullLayout._zoomlayer;e&&_(e)},T.doAutoRangeAndConstraints,r,T.drawData,T.finalDraw)}r.plot=function(t,e,i,a){var s;if(t=o.getGraphDiv(t),l.init(t),o.isPlainObject(e)){var u=e;e=u.data,i=u.layout,a=u.config,s=u.frames}if(!1===l.triggerHandler(t,"plotly_beforeplot",[e,i,a]))return Promise.reject();e||i||o.isPlotDiv(t)||o.warn("Calling Plotly.plot as if redrawing but this container doesn't yet have a plot.",t),R(t,a),i||(i={}),n.select(t).classed("js-plotly-plot",!0),g.makeTester(),Array.isArray(t._promises)||(t._promises=[]);var f=0===(t.data||[]).length&&Array.isArray(e);if(Array.isArray(e)&&(M.cleanData(e),f?t.data=e:t.data.push.apply(t.data,e),t.empty=!1),t.layout&&!f||(t.layout=M.cleanLayout(i)),t._dragging&&!t._transitioning)return t._replotPending=!0,Promise.reject();t._replotPending=!1,h.supplyDefaults(t);var v=t._fullLayout,b=v._has("cartesian");if(!v._has("polar")&&e&&e[0]&&e[0].r)return o.log("Legacy polar charts are deprecated!"),function(t,e,r){var i=n.select(t).selectAll(".plot-container").data([0]);i.enter().insert("div",":first-child").classed("plot-container plotly",!0);var a=i.selectAll(".svg-container").data([0]);a.enter().append("div").classed("svg-container",!0).style("position","relative"),a.html(""),e&&(t.data=e);r&&(t.layout=r);d.manager.fillLayout(t),a.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=d.manager.framework(t),t.framework({data:t.data,layout:t.layout},a.node()),t.framework.setUndoPoint();var s=t.framework.svg(),l=1,u=t._fullLayout.title?t._fullLayout.title.text:"";""!==u&&u||(l=0);var c=function(){this.call(x.convertToTspans,t)},f=s.select(".title-group text").call(c);if(t._context.edits.titleText){var p=o._(t,"Click to enter Plot title");u&&u!==p||(l=.2,f.attr({"data-unformatted":p}).text(p).style({opacity:l}).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)}));var g=function(){this.call(x.makeEditable,{gd:t}).on("edit",function(e){t.framework({layout:{title:{text:e}}}),this.text(e).call(c),this.call(g)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(c)})};f.call(g)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),h.addLinks(t),Promise.resolve()}(t,e,i);v._replotting=!0,f&<(t),t.framework!==lt&&(t.framework=lt,lt(t)),g.initGradients(t),f&&p.saveShowSpikeInitial(t);var _=!t.calcdata||t.calcdata.length!==(t._fullData||[]).length;_&&h.doCalcdata(t);for(var w=0;w=0&&r=0&&r0&&"string"!=typeof P.parts[I];)I--;var N=P.parts[I],D=P.parts[I-1]+"."+N,F=P.parts.slice(0,I).join("."),U=s(t.layout,F).get(),V=s(l,F).get(),q=P.get();if(void 0!==z){w[R]=z,T[R]="reverse"===N?z:j(q);var G=f.getLayoutValObject(l,P.parts);if(G&&G.impliedEdits&&null!==z)for(var X in G.impliedEdits)L(o.relativeAttr(R,X),G.impliedEdits[X]);if(-1!==["width","height"].indexOf(R))if(z){L("autosize",null);var Q="height"===R?"width":"height";L(Q,l[Q])}else l[R]=t._initialAutoSize[R];else if("autosize"===R)L("width",z?null:l.width),L("height",z?null:l.height);else if(D.match(W))O(D),s(l,F+"._inputRange").set(null);else if(D.match(Y)){O(D),s(l,F+"._inputRange").set(null);var J=s(l,F).get();J._inputDomain&&(J._input.domain=J._inputDomain.slice())}else D.match(Z)&&s(l,F+"._inputDomain").set(null);if("type"===N){var K=U,tt="linear"===V.type&&"log"===z,et="log"===V.type&&"linear"===z;if(tt||et){if(K&&K.range)if(V.autorange)tt&&(K.range=K.range[1]>K.range[0]?[1,2]:[2,1]);else{var rt=K.range[0],nt=K.range[1];tt?(rt<=0&&nt<=0&&L(F+".autorange",!0),rt<=0?rt=nt/1e6:nt<=0&&(nt=rt/1e6),L(F+".range[0]",Math.log(rt)/Math.LN10),L(F+".range[1]",Math.log(nt)/Math.LN10)):(L(F+".range[0]",Math.pow(10,rt)),L(F+".range[1]",Math.pow(10,nt)))}else L(F+".autorange",!0);Array.isArray(l._subplots.polar)&&l._subplots.polar.length&&l[P.parts[0]]&&"radialaxis"===P.parts[1]&&delete l[P.parts[0]]._subplot.viewInitial["radialaxis.range"],c.getComponentMethod("annotations","convertCoords")(t,V,z,L),c.getComponentMethod("images","convertCoords")(t,V,z,L)}else L(F+".autorange",!0),L(F+".range",null);s(l,F+"._inputRange").set(null)}else if(N.match(E)){var it=s(l,R).get(),at=(z||{}).type;at&&"-"!==at||(at="linear"),c.getComponentMethod("annotations","convertCoords")(t,it,at,L),c.getComponentMethod("images","convertCoords")(t,it,at,L)}var ot=A.containerArrayMatch(R);if(ot){r=ot.array,n=ot.index;var st=ot.property,lt=G||{editType:"calc"};""!==n&&""===st&&(A.isAddVal(z)?T[R]=null:A.isRemoveVal(z)?T[R]=(s(a,r).get()||[])[n]:o.warn("unrecognized full object value",e)),k.update(_,lt),m[r]||(m[r]={});var ut=m[r][n];ut||(ut=m[r][n]={}),ut[st]=z,delete e[R]}else"reverse"===N?(U.range?U.range.reverse():(L(F+".autorange",!0),U.range=[1,0]),V.autorange?_.calc=!0:_.plot=!0):(l._has("scatter-like")&&l._has("regl")&&"dragmode"===R&&("lasso"===z||"select"===z)&&"lasso"!==q&&"select"!==q?_.plot=!0:l._has("gl2d")?_.plot=!0:G?k.update(_,G):_.calc=!0,P.set(z))}}for(r in m){A.applyContainerArrayChanges(t,h(a,r),m[r],_,h)||(_.plot=!0)}var ct=l._axisConstraintGroups||[];for(S in C)for(n=0;n1;)if(n.pop(),void 0!==(r=s(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function it(t,e){for(var r=0;r=i.length?i[0]:i[t]:i}function l(t){return Array.isArray(a)?t>=a.length?a[0]:a[t]:a}function u(t,e){var r=0;return function(){if(t&&++r===e)return t()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise(function(a,c){function f(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var e=n._currentFrame=n._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=e.frameOpts.duration,h.transition(t,e.frame.data,e.frame.layout,M.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else t.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function d(){t.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var e=function(){n._animationRaf=window.requestAnimationFrame(e),Date.now()-n._lastFrameAt>n._timeToNext&&f()};e()}var p,g,v=0;function m(t){return Array.isArray(i)?v>=i.length?t.transitionOpts=i[v]:t.transitionOpts=i[0]:t.transitionOpts=i,v++,t}var y=[],b=null==e,x=Array.isArray(e);if(!b&&!x&&o.isPlainObject(e))y.push({type:"object",data:m(o.extendFlat({},e))});else if(b||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&AA)&&T.push(g);y=T}}y.length>0?function(e){if(0!==e.length){for(var i=0;i=0;n--)if(o.isPlainObject(e[n])){var g=e[n].name,v=(c[g]||p[g]||{}).name,m=e[n].name,y=c[v]||p[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(c[v]||p[v]).name+'" with a frame whose name of type "number" also equates to "'+v+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===L&&o.warn("addFrames: This API call has yielded too many of these warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),p[g]={name:g},d.push({frame:h.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}d.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(i=d[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!i.name)for(;c[i.name="frame "+t._transitionData._counter++];);if(c[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),s.unshift({type:"insert",index:n,value:i[n]});var l=h.modifyFrames,c=h.modifyFrames,f=[t,s],d=[t,a];return u&&u.add(t,l,f,c,d),h.modifyFrames(t,a)},r.purge=function(t){var e=(t=o.getGraphDiv(t))._fullLayout||{},r=t._fullData||[];return h.cleanPlot([],{},r,e),h.purge(t),l.purge(t),e._container&&e._container.remove(),delete t._context,t}},{"../components/color":376,"../components/colorbar/connect":378,"../components/drawing":397,"../constants/xmlns_namespaces":476,"../lib":495,"../lib/events":487,"../lib/queue":509,"../lib/svg_text_utils":518,"../plots/cartesian/axes":541,"../plots/cartesian/constants":547,"../plots/cartesian/graph_interact":550,"../plots/cartesian/select":558,"../plots/plots":584,"../plots/polar/legacy":587,"../registry":592,"./edit_types":524,"./helpers":525,"./manage_arrays":527,"./plot_config":529,"./plot_schema":530,"./subroutines":532,d3:81,"fast-isnumeric":90,"has-hover":251}],529:[function(t,e,r){"use strict";var n={staticPlot:{valType:"boolean",dflt:!1},plotlyServerURL:{valType:"string",dflt:"https://plot.ly"},editable:{valType:"boolean",dflt:!1},edits:{annotationPosition:{valType:"boolean",dflt:!1},annotationTail:{valType:"boolean",dflt:!1},annotationText:{valType:"boolean",dflt:!1},axisTitleText:{valType:"boolean",dflt:!1},colorbarPosition:{valType:"boolean",dflt:!1},colorbarTitleText:{valType:"boolean",dflt:!1},legendPosition:{valType:"boolean",dflt:!1},legendText:{valType:"boolean",dflt:!1},shapePosition:{valType:"boolean",dflt:!1},titleText:{valType:"boolean",dflt:!1}},autosizable:{valType:"boolean",dflt:!1},responsive:{valType:"boolean",dflt:!1},fillFrame:{valType:"boolean",dflt:!1},frameMargins:{valType:"number",dflt:0,min:0,max:.5},scrollZoom:{valType:"flaglist",flags:["cartesian","gl3d","geo","mapbox"],extras:[!0,!1],dflt:"gl3d+geo+mapbox"},doubleClick:{valType:"enumerated",values:[!1,"reset","autosize","reset+autosize"],dflt:"reset+autosize"},showAxisDragHandles:{valType:"boolean",dflt:!0},showAxisRangeEntryBoxes:{valType:"boolean",dflt:!0},showTips:{valType:"boolean",dflt:!0},showLink:{valType:"boolean",dflt:!1},linkText:{valType:"string",dflt:"Edit chart",noBlank:!0},sendData:{valType:"boolean",dflt:!0},showSources:{valType:"any",dflt:!1},displayModeBar:{valType:"enumerated",values:["hover",!0,!1],dflt:"hover"},showSendToCloud:{valType:"boolean",dflt:!1},modeBarButtonsToRemove:{valType:"any",dflt:[]},modeBarButtonsToAdd:{valType:"any",dflt:[]},modeBarButtons:{valType:"any",dflt:!1},toImageButtonOptions:{valType:"any",dflt:{}},displaylogo:{valType:"boolean",dflt:!0},watermark:{valType:"boolean",dflt:!1},plotGlPixelRatio:{valType:"number",dflt:2,min:1,max:4},setBackground:{valType:"any",dflt:"transparent"},topojsonURL:{valType:"string",noBlank:!0,dflt:"https://cdn.plot.ly/"},mapboxAccessToken:{valType:"string",dflt:null},logging:{valType:"boolean",dflt:1},queueLength:{valType:"integer",min:0,dflt:0},globalTransforms:{valType:"any",dflt:[]},locale:{valType:"string",dflt:"en-US"},locales:{valType:"any",dflt:{}}},i={};!function t(e,r){for(var n in e){var i=e[n];i.valType?r[n]=i.dflt:(r[n]||(r[n]={}),t(i,r[n]))}}(n,i),e.exports={configAttributes:n,dfltConfig:i}},{}],530:[function(t,e,r){"use strict";var n=t("../registry"),i=t("../lib"),a=t("../plots/attributes"),o=t("../plots/layout_attributes"),s=t("../plots/frame_attributes"),l=t("../plots/animation_attributes"),u=t("./plot_config").configAttributes,c=t("../plots/polar/legacy/area_attributes"),f=t("../plots/polar/legacy/axis_attributes"),h=t("./edit_types"),d=i.extendFlat,p=i.extendDeepAll,g=i.isPlainObject,v="_isSubplotObj",m="_isLinkedToArray",y=[v,m,"_arrayAttrRegexps","_deprecated"];function b(t,e,r){if(!t)return!1;if(t._isLinkedToArray)if(x(e[r]))r++;else if(r=a.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!x(o))return!1;t=a[i][o]}else t=a[i]}else t=a}}return t}function x(t){return t===Math.round(t)&&t>=0}function _(t){return function(t){r.crawl(t,function(t,e,n){r.isValObject(t)?"data_array"===t.valType?(t.role="data",n[e+"src"]={valType:"string",editType:"none"}):!0===t.arrayOk&&(n[e+"src"]={valType:"string",editType:"none"}):g(t)&&(t.role="object")})}(t),function(t){r.crawl(t,function(t,e,r){if(!t)return;var n=t[m];if(!n)return;delete t[m],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"})}(t),function(t){!function t(e){for(var r in e)if(g(e[r]))t(e[r]);else if(Array.isArray(e[r]))for(var n=0;n=l.length)return!1;i=(r=(n.transformsRegistry[l[u].type]||{}).attributes)&&r[e[2]],s=3}else if("area"===t.type)i=c[o];else{var f=t._module;if(f||(f=(n.modules[t.type||a.type.dflt]||{})._module),!f)return!1;if(!(i=(r=f.attributes)&&r[o])){var h=f.basePlotModule;h&&h.attributes&&(i=h.attributes[o])}i||(i=a[o])}return b(i,e,s)},r.getLayoutValObject=function(t,e){return b(function(t,e){var r,i,a,s,l=t._basePlotModules;if(l){var u;for(r=0;r=i&&(r._input||{})._templateitemname;s&&(o=i);var l,u=e+"["+o+"]";function c(){l={},s&&(l[u]={},l[u][a]=s)}function f(t,e){s?n.nestedProperty(l[u],t).set(e):l[u+"."+t]=e}function h(){var t=l;return c(),t}return c(),{modifyBase:function(t,e){l[t]=e},modifyItem:f,getUpdateObj:h,applyUpdate:function(e,r){e&&f(e,r);var i=h();for(var a in i)n.nestedProperty(t,a).set(i[a])}}}},{"../lib":495,"../plots/attributes":538}],532:[function(t,e,r){"use strict";var n=t("d3"),i=t("../registry"),a=t("../plots/plots"),o=t("../lib"),s=t("../lib/clear_gl_canvases"),l=t("../components/color"),u=t("../components/drawing"),c=t("../components/titles"),f=t("../components/modebar"),h=t("../plots/cartesian/axes"),d=t("../constants/alignment"),p=t("../plots/cartesian/constraints"),g=p.enforce,v=p.clean,m=t("../plots/cartesian/autorange").doAutoRange,y="start",b="middle",x="end";function _(t,e,r){for(var n=0;n=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}function w(t){var e,i,a,s,c,p,g=t._fullLayout,v=g._size,m=v.p,y=h.list(t,"",!0);if(g._paperdiv.style({width:t._context.responsive&&g.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":g.width+"px",height:t._context.responsive&&g.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":g.height+"px"}).selectAll(".main-svg").call(u.setSize,g.width,g.height),t._context.setBackground(t,g.paper_bgcolor),r.drawMainTitle(t),f.manage(t),!g._has("cartesian"))return t._promises.length&&Promise.all(t._promises);function b(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-m-n:e._offset+e._length+m+n:v.t+v.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+m+n:e._offset-m-n:v.l+v.w*(t.position||0)+n%1}for(e=0;eA?c.push({code:"unused",traceType:y,templateCount:w,dataCount:A}):A>w&&c.push({code:"reused",traceType:y,templateCount:w,dataCount:A})}}else c.push({code:"data"});if(function t(e,r){for(var n in e)if("_"!==n.charAt(0)){var a=e[n],o=d(e,n,r);i(a)?(Array.isArray(e)&&!1===a._template&&a.templateitemname&&c.push({code:"missing",path:o,templateitemname:a.templateitemname}),t(a,o)):Array.isArray(a)&&p(a)&&t(a,o)}}({data:v,layout:h},""),c.length)return c.map(g)}},{"../lib":495,"../plots/attributes":538,"../plots/plots":584,"./plot_config":529,"./plot_schema":530,"./plot_template":531}],534:[function(t,e,r){"use strict";var n=t("./plot_api"),i=t("../lib"),a=t("../snapshot/helpers"),o=t("../snapshot/tosvg"),s=t("../snapshot/svgtoimg"),l={format:{valType:"enumerated",values:["png","jpeg","webp","svg"],dflt:"png"},width:{valType:"number",min:1},height:{valType:"number",min:1},scale:{valType:"number",min:0,dflt:1},setBackground:{valType:"any",dflt:!1},imageDataOnly:{valType:"boolean",dflt:!1}},u=/^data:image\/\w+;base64,/;e.exports=function(t,e){var r,c,f;function h(t){return!(t in e)||i.validate(e[t],l[t])}if(e=e||{},i.isPlainObject(t)?(r=t.data||[],c=t.layout||{},f=t.config||{}):(t=i.getGraphDiv(t),r=i.extendDeep([],t.data),c=i.extendDeep({},t.layout),f=t._context),!h("width")||!h("height"))throw new Error("Height and width should be pixel values.");if(!h("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var d={};function p(t,r){return i.coerce(e,d,l,t,r)}var g=p("format"),v=p("width"),m=p("height"),y=p("scale"),b=p("setBackground"),x=p("imageDataOnly"),_=document.createElement("div");_.style.position="absolute",_.style.left="-5000px",document.body.appendChild(_);var w=i.extendFlat({},c);v&&(w.width=v),m&&(w.height=m);var A=i.extendFlat({},f,{_exportedPlot:!0,staticPlot:!0,setBackground:b}),M=a.getRedrawFunc(_);function T(){return new Promise(function(t){setTimeout(t,a.getDelay(_._fullLayout))})}function k(){return new Promise(function(t,e){var r=o(_,g,y),a=_._fullLayout.width,l=_._fullLayout.height;if(n.purge(_),document.body.removeChild(_),"svg"===g)return t(x?r:"data:image/svg+xml,"+encodeURIComponent(r));var u=document.createElement("canvas");u.id=i.randstr(),s({format:g,width:a,height:l,scale:y,canvas:u,svg:r,promise:!0}).then(t).catch(e)})}return new Promise(function(t,e){n.plot(_,r,w,A).then(M).then(T).then(k).then(function(e){t(function(t){return x?t.replace(u,""):t}(e))}).catch(function(t){e(t)})})}},{"../lib":495,"../snapshot/helpers":596,"../snapshot/svgtoimg":598,"../snapshot/tosvg":600,"./plot_api":528}],535:[function(t,e,r){"use strict";var n=t("../lib"),i=t("../plots/plots"),a=t("./plot_schema"),o=t("./plot_config").dfltConfig,s=n.isPlainObject,l=Array.isArray,u=n.isArrayOrTypedArray;function c(t,e,r,i,a,o){o=o||[];for(var f=Object.keys(t),h=0;hb.length&&i.push(d("unused",a,m.concat(b.length)));var M,T,k,E,L,S=b.length,C=Array.isArray(A);if(C&&(S=Math.min(S,A.length)),2===x.dimensions)for(T=0;Tb[T].length&&i.push(d("unused",a,m.concat(T,b[T].length)));var O=b[T].length;for(M=0;M<(C?Math.min(O,A[T].length):O);M++)k=C?A[T][M]:A,E=y[T][M],L=b[T][M],n.validate(E,k)?L!==E&&L!==+E&&i.push(d("dynamic",a,m.concat(T,M),E,L)):i.push(d("value",a,m.concat(T,M),E))}else i.push(d("array",a,m.concat(T),y[T]));else for(T=0;T1&&h.push(d("object","layout"))),i.supplyDefaults(p);for(var g=p._fullData,v=r.length,m=0;m0&&((x=T-o(v)-o(m))>k?_/x>E&&(y=v,b=m,E=_/x):_/T>E&&(y={val:v.val,pad:0},b={val:m.val,pad:0},E=_/T));if(h===d){var L=h-1,S=h+1;if(A)if(0===h)a=[0,1];else{var C=(h>0?f:c).reduce(function(t,e){return Math.max(t,o(e))},0),O=h/(1-Math.min(.5,C/T));a=h>0?[0,O]:[O,0]}else a=M?[Math.max(0,L),Math.max(1,S)]:[L,S]}else A?(y.val>=0&&(y={val:0,pad:0}),b.val<=0&&(b={val:0,pad:0})):M&&(y.val-E*o(y)<0&&(y={val:0,pad:0}),b.val<=0&&(b={val:1,pad:0})),E=(b.val-y.val)/(T-o(y)-o(b)),a=[y.val-E*o(y),b.val+E*o(b)];return p&&a.reverse(),i.simpleMap(a,e.l2r||Number)}function l(t){var e=t._length/20;return"domain"===t.constrain&&t._inputDomain&&(e*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0])),function(t){return t.pad+(t.extrapad?e:0)}}function u(t,e){var r,n,i,a=e._id,o=t._fullData,s=t._fullLayout,l=[],u=[];function h(t,e){for(r=0;r=r&&(u.extrapad||!o)){s=!1;break}i(e,u.val)&&u.pad<=r&&(o||!u.extrapad)&&(t.splice(l,1),l--)}if(s){var c=a&&0===e;t.push({val:e,pad:c?0:r,extrapad:!c&&o})}}function d(t){return n(t)&&Math.abs(t)=e}e.exports={getAutoRange:s,makePadFn:l,doAutoRange:function(t,e){if(e.setScale(),e.autorange){e.range=s(t,e),e._r=e.range.slice(),e._rl=i.simpleMap(e._r,e.r2l);var r=e._input,n={};n[e._attr+".range"]=e.range,n[e._attr+".autorange"]=e.autorange,o.call("_storeDirectGUIEdit",t.layout,t._fullLayout._preGUI,n),r.range=e.range.slice(),r.autorange=e.autorange}var a=e._anchorAxis;if(a&&a.rangeslider){var l=a.rangeslider[e._name];l&&"auto"===l.rangemode&&(l.range=s(t,e)),a._input.rangeslider[e._name]=i.extendFlat({},l)}},findExtremes:function(t,e,r){r||(r={});t._m||t.setScale();var i,o,s,l,u,h,p,g,v,m=[],y=[],b=e.length,x=r.padded||!1,_=r.tozero&&("linear"===t.type||"-"===t.type),w="log"===t.type,A=!1;function M(t){if(Array.isArray(t))return A=!0,function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}var T=M((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),k=M((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),E=M(r.vpadplus||r.vpad),L=M(r.vpadminus||r.vpad);if(!A){if(g=1/0,v=-1/0,w)for(i=0;i0&&(g=o),o>v&&o-a&&(g=o),o>v&&o=O;i--)C(i);return{min:m,max:y,opts:r}},concatExtremes:u}},{"../../constants/numerical":475,"../../lib":495,"../../registry":592,"fast-isnumeric":90}],541:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),u=t("../../components/titles"),c=t("../../components/color"),f=t("../../components/drawing"),h=t("./layout_attributes"),d=t("./clean_ticks"),p=t("../../constants/numerical"),g=p.ONEAVGYEAR,v=p.ONEAVGMONTH,m=p.ONEDAY,y=p.ONEHOUR,b=p.ONEMIN,x=p.ONESEC,_=p.MINUS_SIGN,w=p.BADNUM,A=t("../../constants/alignment").MID_SHIFT,M=t("../../constants/alignment").LINE_SPACING,T=e.exports={};T.setConvert=t("./set_convert");var k=t("./axis_autotype"),E=t("./axis_ids");T.id2name=E.id2name,T.name2id=E.name2id,T.cleanId=E.cleanId,T.list=E.list,T.listIds=E.listIds,T.getFromId=E.getFromId,T.getFromTrace=E.getFromTrace;var L=t("./autorange");T.getAutoRange=L.getAutoRange,T.findExtremes=L.findExtremes,T.coerceRef=function(t,e,r,n,i,a){var o=n.charAt(n.length-1),l=r._fullLayout._subplots[o+"axis"],u=n+"ref",c={};return i||(i=l[0]||a),a||(a=i),c[u]={valType:"enumerated",values:l.concat(a?[a]:[]),dflt:i},s.coerce(t,e,c,u)},T.coercePosition=function(t,e,r,n,i,a){var o,l;if("paper"===n||"pixel"===n)o=s.ensureNumber,l=r(i,a);else{var u=T.getFromId(e,n);l=r(i,a=u.fraction2r(a)),o=u.cleanPos}t[i]=o(l)},T.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:T.getFromId(e,r).cleanPos)(t)},T.redrawComponents=function(t,e){e=e||T.listIds(t);var r=t._fullLayout;function n(n,i,a,s){for(var l=o.getComponentMethod(n,i),u={},c=0;c2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;i.3*h||c(n)||c(a))){var d=r.dtick/2;t+=t+d.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=T.tickIncrement(t,"M6","reverse")+1.5*m:a.exactMonths>.8?t=T.tickIncrement(t,"M1","reverse")+15.5*m:t-=m/2;var l=T.tickIncrement(t,r);if(l<=n)return l}return t}(b,t,y,u,a)),v=b,0;v<=c;)v=T.tickIncrement(v,y,!1,a),0;return{start:e.c2r(b,0,a),end:e.c2r(v,0,a),size:y,_dataSpan:c-u}},T.prepTicks=function(t){var e=s.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type||"multicategory"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=s.constrain(t._length/r,4,9)+1),"radialaxis"===t._name&&(n*=2)),"array"===t.tickmode&&(n*=100),T.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),"date"===t.type&&t.dtick<.1&&(t.dtick=.1),B(t)},T.calcTicks=function(t){T.prepTicks(t);var e=s.simpleMap(t.range,t.r2l);if("array"===t.tickmode)return function(t){var e=t.tickvals,r=t.ticktext,n=new Array(e.length),i=s.simpleMap(t.range,t.r2l),a=1.0001*i[0]-1e-4*i[1],o=1.0001*i[1]-1e-4*i[0],l=Math.min(a,o),u=Math.max(a,o),c=0;Array.isArray(r)||(r=[]);var f="category"===t.type?t.d2l_noadd:t.d2l;"log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1));for(var h=0;hl&&d=n:u<=n)&&!(a.length>l||u===o);u=T.tickIncrement(u,t.dtick,i,t.calendar))o=u,a.push(u);rt(t)&&360===Math.abs(e[1]-e[0])&&a.pop(),t._tmax=a[a.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(a.length),f=0;f10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=m&&a<=10||e>=15*m)t._tickround="d";else if(e>=b&&a<=16||e>=y)t._tickround="M";else if(e>=x&&a<=19||e>=b)t._tickround="S";else{var o=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20,t._tickround<0&&(t._tickround=4)}}else if(i(e)||"L"===e.charAt(0)){var s=t.range.map(t.r2d||Number);i(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(s[0]),Math.abs(s[1])),u=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(u)>3&&(H(t.exponentformat)&&!q(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function U(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}T.autoTicks=function(t,e){var r;function n(t){return Math.pow(t,Math.floor(Math.log(e)/Math.LN10))}if("date"===t.type){t.tick0=s.dateTick0(t.calendar);var a=2*e;a>g?(e/=g,r=n(10),t.dtick="M"+12*j(e,r,R)):a>v?(e/=v,t.dtick="M"+j(e,1,P)):a>m?(t.dtick=j(e,m,I),t.tick0=s.dateTick0(t.calendar,!0)):a>y?t.dtick=j(e,y,P):a>b?t.dtick=j(e,b,z):a>x?t.dtick=j(e,x,z):(r=n(10),t.dtick=j(e,r,R))}else if("log"===t.type){t.tick0=0;var o=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var l=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/l,r=n(10),t.dtick="L"+j(e,r,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type||"multicategory"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):rt(t)?(t.tick0=0,r=1,t.dtick=j(e,r,F)):(t.tick0=0,r=n(10),t.dtick=j(e,r,R));if(0===t.dtick&&(t.dtick=1),!i(t.dtick)&&"string"!=typeof t.dtick){var u=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(u)}},T.tickIncrement=function(t,e,r,a){var o=r?-1:1;if(i(e))return t+o*e;var l=e.charAt(0),u=o*Number(e.substr(1));if("M"===l)return s.incrementMonth(t,u,a);if("L"===l)return Math.log(Math.pow(10,t)+u)/Math.LN10;if("D"===l){var c="D2"===e?D:N,f=t+.01*o,h=s.roundUp(s.mod(f,1),c,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.r2l||Number,r=s.simpleMap(t.range,e),a=r[1]"+l,t._prevDateHead=l));e.text=u}(t,a,r,l):"log"===u?function(t,e,r,n,a){var o=t.dtick,l=e.x,u=t.tickformat,c="string"==typeof o&&o.charAt(0);"never"===a&&(a="");n&&"L"!==c&&(o="L3",c="L");if(u||"L"===c)e.text=G(Math.pow(10,l),t,a,n);else if(i(o)||"D"===c&&s.mod(l+.01,1)<.1){var f=Math.round(l),h=Math.abs(f),d=t.exponentformat;"power"===d||H(d)&&q(f)?(e.text=0===f?1:1===f?"10":"10"+(f>1?"":_)+h+"",e.fontSize*=1.25):("e"===d||"E"===d)&&h>2?e.text="1"+d+(f>0?"+":_)+h:(e.text=G(Math.pow(10,l),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if("D"!==c)throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,s.mod(l,1)))),e.fontSize*=.75}if("D1"===t.dtick){var p=String(e.text).charAt(0);"0"!==p&&"1"!==p||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(l<0?.5:.25)))}}(t,a,0,l,p):"category"===u?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,a):"multicategory"===u?function(t,e,r){var n=Math.round(e.x),i=t._categories[n]||[],a=void 0===i[1]?"":String(i[1]),o=void 0===i[0]?"":String(i[0]);r?e.text=o+" - "+a:(e.text=a,e.text2=o)}(t,a,r):rt(t)?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=G(e.x,t,i,n);else{var a=e.x/180;if(0===a)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){var r=1;for(;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,i=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/i),Math.round(r/i)]}(a);if(o[1]>=100)e.text=G(s.deg2rad(e.x),t,i,n);else{var l=e.x<0;1===o[1]?1===o[0]?e.text="\u03c0":e.text=o[0]+"\u03c0":e.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),l&&(e.text=_+e.text)}}}}(t,a,r,l,p):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide");e.text=G(e.x,t,i,n)}(t,a,0,l,p),t.tickprefix&&!d(t.showtickprefix)&&(a.text=t.tickprefix+a.text),t.ticksuffix&&!d(t.showticksuffix)&&(a.text+=t.ticksuffix),"boundaries"===t.tickson||t.showdividers){var g=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};a.xbnd=[g(a.x-.5),g(a.x+t.dtick-.5)]}return a},T.hoverLabelText=function(t,e,r){if(r!==w&&r!==e)return T.hoverLabelText(t,e)+" - "+T.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=T.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":_+i:i};var V=["f","p","n","\u03bc","m","","k","M","G","T"];function H(t){return"SI"===t||"B"===t}function q(t){return t>14||t<-15}function G(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=T.getTickFormat(e),f=e.separatethousands;if(n){var h={exponentformat:l,dtick:"none"===e.showexponent?e.dtick:i(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};B(h),o=(Number(h._tickround)||0)+4,u=h._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,_);var d,p=Math.pow(10,-o)/2;if("none"===l&&(u=0),(t=Math.abs(t))"+d+"":"B"===l&&9===u?t+="B":H(l)&&(t+=V[u/3+5]));return a?_+t:t}function X(t,e){var r=t._id.charAt(0),n=t._tickAngles[e]||0,i=s.deg2rad(n),a=Math.sin(i),o=Math.cos(i),l=0,u=0;return t._selections[e].each(function(){var t=Q(this),e=f.bBox(t.node()),r=e.width,n=e.height;l=Math.max(l,o*r,a*n),u=Math.max(u,a*r,o*n)}),{x:u,y:l}[r]}function W(t){return[t.text,t.x,t.axInfo,t.font,t.fontSize,t.fontColor].join("_")}function Y(t,e){var r,n=t._fullLayout._size,i=e._id.charAt(0),a=e.side;return"free"!==e.anchor?r=E.getFromId(t,e.anchor):"x"===i?r={_offset:n.t+(1-(e.position||0))*n.h,_length:0}:"y"===i&&(r={_offset:n.l+(e.position||0)*n.w,_length:0}),"top"===a||"left"===a?r._offset:"bottom"===a||"right"===a?r._offset+r._length:void 0}function Z(t,e){var r=t.l2p(e);return r>1&&r=0,a=c(t,e[1])<=0;return(r||i)&&(n||a)}if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(e=0;e=o(i)))){r=n;break}break;case"log":for(e=0;e0&&(r[i]+=l),e.title.text!==h._dfltTitle[p]&&(r[i]+=e.title.font.size),"x"===p&&u.width>0){var f=u.right-(e._offset+e._length);f>0&&(r.x=1,r.r=f);var d=e._offset-u.left;d>0&&(r.x=0,r.l=d)}else if("y"===p&&u.height>0){var v=u.bottom-(e._offset+e._length);v>0&&(r.y=0,r.b=v);var m=e._offset-u.top;m>0&&(r.y=1,r.t=m)}}a.autoMargin(t,$(e),r)}),r.skipTitle||tt&&e._boundingBox&&"bottom"===e.side||G.push(function(){return function(t,e){var r,n=t._fullLayout,i=e._id,a=i.charAt(0),o=e.title.font.size;if("multicategory"===e.type)r=e._labelLength;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}var s,l,c,h,d=Y(t,e);"x"===a?(l=e._offset+e._length/2,c="top"===e.side?-r-o*(e.showticklabels?1:0):r+o*(e.showticklabels?1.5:.5),c+=d):(c=e._offset+e._length/2,l="right"===e.side?r+o*(e.showticklabels?1:.5):-r-o*(e.showticklabels?.5:0),l+=d,s={rotate:"-90",offset:0});if("multicategory"!==e.type){var p=e._selections[e._id+"tick"];if(h={selection:p,side:e.side},p&&p.node()&&p.node().parentNode){var g=f.getTranslate(p.node().parentNode);h.offsetLeft=g.x,h.offsetTop=g.y}}return u.draw(t,i+"title",{propContainer:e,propName:e._name+".title.text",placeholder:n._dfltTitle[a],avoid:h,transform:s,attributes:{x:l,y:c,"text-anchor":"middle"}})}(t,e)}),s.syncOrAsync(G)}function et(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.max(t[1],e[1])}},T.getTickSigns=function(t){var e=t._id.charAt(0),r={x:"top",y:"right"}[e],n=t.side===r?1:-1,i=[-1,1,n,-n];return"inside"!==t.ticks==("x"===e)&&(i=i.map(function(t){return-t})),i},T.makeTransFn=function(t){var e=t._id.charAt(0),r=t._offset;return"x"===e?function(e){return"translate("+(r+t.l2p(e.x))+",0)"}:function(e){return"translate(0,"+(r+t.l2p(e.x))+")"}},T.makeTickPath=function(t,e,r,n){n=void 0!==n?n:t.ticklen;var i=t._id.charAt(0),a=(t.linewidth||1)/2;return"x"===i?"M0,"+(e+a*r)+"v"+n*r:"M"+(e+a*r)+",0h"+n*r},T.makeLabelFns=function(t,e,r){var n=t._id.charAt(0),a="boundaries"!==t.tickson&&"outside"===t.ticks,o=0,l=0;if(a&&(o+=t.ticklen),r&&"outside"===t.ticks){var u=s.deg2rad(r);o=t.ticklen*Math.cos(u)+1,l=t.ticklen*Math.sin(u)}t.showticklabels&&(a||t.showline)&&(o+=.2*t.tickfont.size);var c,f,h,d,p={labelStandoff:o+=(t.linewidth||1)/2,labelShift:l};return"x"===n?(d="bottom"===t.side?1:-1,c=l*d,f=e+o*d,h="bottom"===t.side?1:-.2,p.xFn=function(t){return t.dx+c},p.yFn=function(t){return t.dy+f+t.fontSize*h},p.anchorFn=function(t,e){return i(e)&&0!==e&&180!==e?e*d<0?"end":"start":"middle"},p.heightFn=function(e,r,n){return r<-60||r>60?-.5*n:"top"===t.side?-n:0}):"y"===n&&(d="right"===t.side?1:-1,c=o,f=-l*d,h=90===Math.abs(t.tickangle)?.5:0,p.xFn=function(t){return t.dx+e+(c+t.fontSize*h)*d},p.yFn=function(t){return t.dy+f+t.fontSize*A},p.anchorFn=function(e,r){return i(r)&&90===Math.abs(r)?"middle":"right"===t.side?"start":"end"},p.heightFn=function(e,r,n){return(r*="left"===t.side?1:-1)<-30?-n:r<30?-.5*n:0}),p},T.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",i=r.layer.selectAll("path."+n).data(e.ticks?r.vals:[],W);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(c.stroke,e.tickcolor).style("stroke-width",f.crispRound(t,e.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},T.drawGrid=function(t,e,r){r=r||{};var n=e._id+"grid",i=r.vals,a=r.counterAxis;if(!1===e.showgrid)i=[];else if(a&&T.shouldShowZeroLine(t,e,a))for(var o="array"===e.tickmode,s=0;s1)for(n=1;n2*o}(t,e)?"date":function(t){for(var e=Math.max(1,(t.length-1)/1e3),r=0,n=0,o={},s=0;s2*r}(t)?"category":function(t){if(!t)return!1;for(var e=0;en?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)},r.getAxisGroup=function(t,e){for(var r=t._axisMatchGroups,n=0;n0;o&&(i="array");var s,l=r("categoryorder",i);"array"===l&&(s=r("categoryarray")),o||"array"!==l||(l=e.categoryorder="trace"),"trace"===l?e._initialCategories=[]:"array"===l?e._initialCategories=s.slice():(s=function(t,e){var r,n,i,a=e.dataAttr||t._id.charAt(0),o={};if(e.axData)r=e.axData;else for(r=[],n=0;nl*b)||A)for(r=0;rP&&NO&&(O=N);d/=(O-C)/(2*R),C=u.l2r(C),O=u.l2r(O),u.range=u._input.range=E=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function z(t,e,r,n,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",i+"Z")}function I(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function N(t,e,r,n,i,a){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),D(t,e,i,a)}function D(t,e,r,n){r||(t.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function F(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function j(t){E&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),E=!1)}function B(t){return"lasso"===t||"select"===t}function U(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,k)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function V(t,e,r,n){for(var i,a,o,l,u=!1,c={},f={},h=0;h-1&&w(i,t,Y,Z,e.id,Et),a.indexOf("event")>-1&&f.click(t,i,e.id);else if(1===r&&dt){var s=E?G:D,u="s"===E||"w"===L?0:1,c=s._name+".range["+u+"]",h=function(t,e){var r,i=t.range[e],a=Math.abs(i-t.range[1-e]);return"date"===t.type?i:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(a)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,i))):(r=Math.floor(Math.log(Math.abs(i))/Math.LN10)-Math.floor(Math.log(a)/Math.LN10)+4,n.format("."+String(r)+"g")(i))}(s,u),d="left",p="middle";if(s.fixedrange)return;E?(p="n"===E?"top":"bottom","right"===s.side&&(d="right")):"e"===L&&(d="right"),t._context.showAxisRangeEntryBoxes&&n.select(vt).call(l.makeEditable,{gd:t,immediate:!0,background:t._fullLayout.paper_bgcolor,text:String(h),fill:s.tickfont?s.tickfont.color:"#444",horizontalAlign:d,verticalAlign:p}).on("edit",function(e){var r=s.d2r(e);void 0!==r&&o.call("_guiRelayout",t,c,r)})}}function Ct(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(J,e+mt)),i=Math.max(0,Math.min(K,r+yt)),a=Math.abs(n-mt),o=Math.abs(i-yt);function s(){At="",bt.r=bt.l,bt.t=bt.b,Tt.attr("d","M0,0Z")}if(bt.l=Math.min(mt,n),bt.r=Math.max(mt,n),bt.t=Math.min(yt,i),bt.b=Math.max(yt,i),tt.isSubplotConstrained)a>k||o>k?(At="xy",a/J>o/K?(o=a*K/J,yt>i?bt.t=yt-o:bt.b=yt+o):(a=o*J/K,mt>n?bt.l=mt-a:bt.r=mt+a),Tt.attr("d",U(bt))):s();else if(et.isSubplotConstrained)if(a>k||o>k){At="xy";var l=Math.min(bt.l/J,(K-bt.b)/K),u=Math.max(bt.r/J,(K-bt.t)/K);bt.l=l*J,bt.r=u*J,bt.b=(1-l)*K,bt.t=(1-u)*K,Tt.attr("d",U(bt))}else s();else!nt||og[1]-1/4096&&(e.domain=s),i.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":495,"fast-isnumeric":90}],557:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var i=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=i[0]+(i[1]-i[0])*r;t.range=t._input.range=[t.l2r(a+(i[0]-a)*e),t.l2r(a+(i[1]-a)*e)]}},{"../../constants/alignment":471}],558:[function(t,e,r){"use strict";var n=t("polybooljs"),i=t("../../registry"),a=t("../../components/color"),o=t("../../components/fx"),s=t("../../lib/polygon"),l=t("../../lib/throttle"),u=t("../../components/fx/helpers").makeEventData,c=t("./axis_ids").getFromId,f=t("../../lib/clear_gl_canvases"),h=t("../../plot_api/subroutines").redrawReglTraces,d=t("./constants"),p=d.MINSELECT,g=s.filter,v=s.tester;function m(t){return t._id}function y(t,e,r,n,i,a,o){var s,l,u,c,f,h,d,p,g,v=e._hoverdata,m=e._fullLayout.clickmode.indexOf("event")>-1,y=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(v)){w(t,e,a);var b=function(t,e){var r,n,i=t[0],a=-1,o=[];for(n=0;n0?function(t,e){var r,n,i,a=[];for(i=0;i0&&a.push(r);if(1===a.length&&a[0]===e.searchInfo&&(n=e.searchInfo.cd[0].trace).selectedpoints.length===e.pointNumbers.length){for(i=0;i1)return!1;if((i+=r.selectedpoints.length)>1)return!1}return 1===i}(s)&&(h=k(b))){for(o&&o.remove(),g=0;g0?"M"+i.join("M")+"Z":"M0,0Z",e.attr("d",n)}function k(t){var e=t.searchInfo.cd[0].trace,r=t.pointNumber,n=t.pointNumbers,i=n.length>0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(i)>-1}function E(t,e,r){var n,a,o,s;for(n=0;n-1&&y(e,k,i.xaxes,i.yaxes,i.subplot,i,q),"event"===r&&k.emit("plotly_selected",void 0);o.click(k,e)})},i.doneFn=function(){X.remove(),l.done(W).then(function(){l.clear(W),i.gd.emit("plotly_selected",x),h&&i.selectionDefs&&(h.subtract=H,i.selectionDefs.push(h),i.mergedPolygons.length=0,[].push.apply(i.mergedPolygons,f))})}},clearSelect:S,selectOnClick:y}},{"../../components/color":376,"../../components/fx":415,"../../components/fx/helpers":411,"../../lib/clear_gl_canvases":483,"../../lib/polygon":507,"../../lib/throttle":519,"../../plot_api/subroutines":532,"../../registry":592,"./axis_ids":544,"./constants":547,polybooljs:299}],559:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../lib"),o=a.cleanNumber,s=a.ms2DateTime,l=a.dateTime2ms,u=a.ensureNumber,c=a.isArrayOrTypedArray,f=t("../../constants/numerical"),h=f.FP_SAFE,d=f.BADNUM,p=f.LOG_CLIP,g=t("./constants"),v=t("./axis_ids");function m(t){return Math.pow(10,t)}function y(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",f=r.charAt(0);function b(e,r){if(e>0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-2*p*Math.abs(n-i))}return d}function x(e,r,n){var o=l(e,n||t.calendar);if(o===d){if(!i(e))return d;e=+e;var s=Math.floor(10*a.mod(e+.05,1)),u=Math.round(e-s/10);o=l(new Date(u))+s/10}return o}function _(e,r,n){return s(e,r,n||t.calendar)}function w(e){return t._categories[Math.round(e)]}function A(e){if(y(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function M(e){if(t._categoriesMap)return t._categoriesMap[e]}function T(t){var e=M(t);return void 0!==e?e:i(t)?+t:void 0}function k(e){return i(e)?n.round(t._b+t._m*e,2):d}function E(e){return(e-t._b)/t._m}t.c2l="log"===t.type?b:u,t.l2c="log"===t.type?m:u,t.l2p=k,t.p2l=E,t.c2p="log"===t.type?function(t,e){return k(b(t,e))}:k,t.p2c="log"===t.type?function(t){return m(E(t))}:E,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=o,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(o(e))},t.p2d=t.p2r=E,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return b(o(t),e)},t.r2d=t.r2c=function(t){return m(o(t))},t.d2c=t.r2l=o,t.c2d=t.l2r=u,t.c2r=b,t.l2d=m,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return m(E(t))},t.r2p=function(e){return t.l2p(o(e))},t.p2r=E,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=a.identity,t.d2c=t.r2c=t.d2l=t.r2l=x,t.c2d=t.c2r=t.l2d=t.l2r=_,t.d2p=t.r2p=function(e,r,n){return t.l2p(x(e,0,n))},t.p2d=t.p2r=function(t,e,r){return _(E(t),e,r)},t.cleanPos=function(e){return a.cleanDate(e,d,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=A,t.r2d=t.c2d=t.l2d=w,t.d2r=t.d2l_noadd=T,t.r2c=function(e){var r=T(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=T,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return w(E(t))},t.r2p=t.d2p,t.p2r=E,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=w,t.d2r=t.d2l_noadd=T,t.r2c=function(e){var r=T(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=M,t.l2r=t.c2r=u,t.r2l=T,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return w(E(t))},t.r2p=t.d2p,t.p2r=E,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:u(t)},t.setupMultiCategory=function(n){var i,o,s=t._traceIndices,l=e._axisMatchGroups;if(l&&l.length&&0===t._categories.length)for(i=0;ih&&(s[n]=h),s[0]===s[1]){var u=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=u,s[1]+=u}}else a.nestedProperty(t,e).set(o)},t.setScale=function(r){var n=e._size;if(t.overlaying){var i=v.getFromId({_fullLayout:e},t.overlaying);t.domain=i.domain}var a=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(a);var s=t.r2l(t[a][0],o),l=t.r2l(t[a][1],o);if("y"===f?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b)||t._length<0)throw e._replotting=!1,new Error("Something went wrong with axis scaling")},t.makeCalcdata=function(e,r){var n,i,o,s,l=t.type,u="date"===l&&e[r+"calendar"];if(r in e){if(n=e[r],s=e._length||a.minRowLength(n),a.isTypedArray(n)&&("linear"===l||"log"===l)){if(s===n.length)return n;if(n.subarray)return n.subarray(0,s)}if("multicategory"===l)return function(t,e){for(var r=new Array(e),n=0;nr.duration?(function(){for(var r={},n=0;n rect").call(a.setTranslate,0,0).call(a.setScale,1,1),t.plot.call(a.setTranslate,e._offset,r._offset).call(a.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(a.setPointGroupScale,1,1),n.selectAll(".textpoint").call(a.setTextPointsScale,1,1),n.call(a.hideOutsideRangePoints,t)}function g(e,r){var n=e.plotinfo,i=n.xaxis,s=n.yaxis,l=e.xr0,u=e.xr1,c=i._length,f=e.yr0,h=e.yr1,d=s._length,p=!!u,g=!!h,v=[];if(p){var m=l[1]-l[0],y=u[1]-u[0];v[0]=(l[0]*(1-r)+r*u[0]-l[0])/(l[1]-l[0])*c,v[2]=c*(1-r+r*y/m),i.range[0]=l[0]*(1-r)+r*u[0],i.range[1]=l[1]*(1-r)+r*u[1]}else v[0]=0,v[2]=c;if(g){var b=f[1]-f[0],x=h[1]-h[0];v[1]=(f[1]*(1-r)+r*h[1]-f[1])/(f[0]-f[1])*d,v[3]=d*(1-r+r*x/b),s.range[0]=f[0]*(1-r)+r*h[0],s.range[1]=f[1]*(1-r)+r*h[1]}else v[1]=0,v[3]=d;o.drawOne(t,i,{skipTitle:!0}),o.drawOne(t,s,{skipTitle:!0}),o.redrawComponents(t,[i._id,s._id]);var _=p?c/v[2]:1,w=g?d/v[3]:1,A=p?v[0]:0,M=g?v[1]:0,T=p?v[0]/v[2]*c:0,k=g?v[1]/v[3]*d:0,E=i._offset-T,L=s._offset-k;n.clipRect.call(a.setTranslate,A,M).call(a.setScale,1/_,1/w),n.plot.call(a.setTranslate,E,L).call(a.setScale,_,w),a.setPointGroupScale(n.zoomScalePts,1/_,1/w),a.setTextPointsScale(n.zoomScaleTxt,1/_,1/w)}o.redrawComponents(t)}},{"../../components/drawing":397,"../../registry":592,"./axes":541,d3:81}],564:[function(t,e,r){"use strict";var n=t("../../registry").traceIs,i=t("./axis_autotype");function a(t){return{v:"x",h:"y"}[t.orientation||"v"]}function o(t,e){var r=a(t),i=n(t,"box-violin"),o=n(t._fullInput||{},"candlestick");return i&&!o&&e===r&&void 0===t[r]&&void 0===t[r+"0"]}e.exports=function(t,e,r,s){"-"===r("type",(s.splomStash||{}).type)&&(!function(t,e){if("-"!==t.type)return;var r=t._id,s=r.charAt(0);-1!==r.indexOf("scene")&&(r=s);var l=function(t,e,r){for(var n=0;n0&&(i["_"+r+"axes"]||{})[e])return i;if((i[r+"axis"]||r)===e){if(o(i,r))return i;if((i[r]||[]).length||i[r+"0"])return i}}}(e,r,s);if(!l)return;if("histogram"===l.type&&s==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");var u,c=s+"calendar",f=l[c],h={noMultiCategory:!n(l,"cartesian")||n(l,"noMultiCategory")};if(o(l,s)){var d=a(l),p=[];for(u=0;u0?".":"")+a;i.isPlainObject(o)?l(o,e,s,n+1):e(s,a,o)}})}r.manageCommandObserver=function(t,e,n,o){var s={},l=!0;e&&e._commandObserver&&(s=e._commandObserver),s.cache||(s.cache={}),s.lookupTable={};var u=r.hasSimpleAPICommandBindings(t,n,s.lookupTable);if(e&&e._commandObserver){if(u)return s;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,s}if(u){a(t,u,s.cache),s.check=function(){if(l){var e=a(t,u,s.cache);return e.changed&&o&&void 0!==s.lookupTable[e.value]&&(s.disable(),Promise.resolve(o({value:e.value,type:u.type,prop:u.prop,traces:u.traces,index:s.lookupTable[e.value]})).then(s.enable,s.enable)),e.changed}};for(var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f.999&&(v="turntable"):v="turntable")}else v="turntable";r("dragmode",v),r("hovermode",n.getDfltFromLayout("hovermode"))}e.exports=function(t,e,r){var i=e._basePlotModules.length>1;o(t,e,r,{type:c,attributes:l,handleDefaults:f,fullLayout:e,font:e.font,fullData:r,getDfltFromLayout:function(e){if(!i)return n.validate(t[e],l[e])?t[e]:void 0},paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":376,"../../../lib":495,"../../../registry":592,"../../get_data":569,"../../subplot_defaults":591,"./axis_defaults":573,"./layout_attributes":576}],576:[function(t,e,r){"use strict";var n=t("./axis_attributes"),i=t("../../domain").attributes,a=t("../../../lib/extend").extendFlat,o=t("../../../lib").counterRegex;function s(t,e,r){return{x:{valType:"number",dflt:t,editType:"camera"},y:{valType:"number",dflt:e,editType:"camera"},z:{valType:"number",dflt:r,editType:"camera"},editType:"camera"}}e.exports={_arrayAttrRegexps:[o("scene",".annotations",!0)],bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"plot"},camera:{up:a(s(0,0,1),{}),center:a(s(0,0,0),{}),eye:a(s(1.25,1.25,1.25),{}),projection:{type:{valType:"enumerated",values:["perspective","orthographic"],dflt:"perspective",editType:"calc"},editType:"calc"},editType:"camera"},domain:i({name:"scene",editType:"plot"}),aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto",editType:"plot",impliedEdits:{"aspectratio.x":void 0,"aspectratio.y":void 0,"aspectratio.z":void 0}},aspectratio:{x:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},y:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},z:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},editType:"plot",impliedEdits:{aspectmode:"manual"}},xaxis:n,yaxis:n,zaxis:n,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],editType:"plot"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest",editType:"modebar"},uirevision:{valType:"any",editType:"none"},editType:"plot",_deprecated:{cameraposition:{valType:"info_array",editType:"camera"}}}},{"../../../lib":495,"../../../lib/extend":488,"../../domain":566,"./axis_attributes":572}],577:[function(t,e,r){"use strict";var n=t("../../../lib/str2rgbarray"),i=["xaxis","yaxis","zaxis"];function a(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}a.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[i[e]];r.visible?(this.enabled[e]=r.showspikes,this.colors[e]=n(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness):(this.enabled[e]=!1,this.drawSides[e]=!1)}},e.exports=function(t){var e=new a;return e.merge(t),e}},{"../../../lib/str2rgbarray":517}],578:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.axesOptions,r=t.glplot.axesPixels,s=t.fullSceneLayout,l=[[],[],[]],u=0;u<3;++u){var c=s[a[u]];if(c._length=(r[u].hi-r[u].lo)*r[u].pixelsPerDataUnit/t.dataScale[u],Math.abs(c._length)===1/0||isNaN(c._length))l[u]=[];else{c._input_range=c.range.slice(),c.range[0]=r[u].lo/t.dataScale[u],c.range[1]=r[u].hi/t.dataScale[u],c._m=1/(t.dataScale[u]*r[u].pixelsPerDataUnit),c.range[0]===c.range[1]&&(c.range[0]-=1,c.range[1]+=1);var f=c.tickmode;if("auto"===c.tickmode){c.tickmode="linear";var h=c.nticks||i.constrain(c._length/40,4,9);n.autoTicks(c,Math.abs(c.range[1]-c.range[0])/h)}for(var d=n.calcTicks(c),p=0;p/g," "));l[u]=d,c.tickmode=f}}e.ticks=l;for(var u=0;u<3;++u){o[u]=.5*(t.glplot.bounds[0][u]+t.glplot.bounds[1][u]);for(var p=0;p<2;++p)e.bounds[p][u]=t.glplot.bounds[p][u]}t.contourLevels=function(t){for(var e=new Array(3),r=0;r<3;++r){for(var n=t[r],i=new Array(n.length),a=0;a")):"isosurface"===e.type?(x.valueLabel=f.tickText(t.mockAxis,t.mockAxis.d2l(u.traceCoordinate[3]),"hover").text,M.push("value: "+x.valueLabel),u.textLabel&&M.push(u.textLabel),m=M.join("
")):m=u.textLabel;var T={x:u.traceCoordinate[0],y:u.traceCoordinate[1],z:u.traceCoordinate[2],data:e._input,fullData:e,curveNumber:e.index,pointNumber:b};h.appendArrayPointValue(T,e,b),e._module.eventData&&(T=e._module.eventData(T,u,e,{},b));var k={points:[T]};t.fullSceneLayout.hovermode&&h.loneHover({trace:e,x:(.5+.5*v[0]/v[3])*i,y:(.5-.5*v[1]/v[3])*a,xLabel:x.xLabel,yLabel:x.yLabel,zLabel:x.zLabel,text:m,name:l.name,color:h.castHoverOption(e,b,"bgcolor")||l.color,borderColor:h.castHoverOption(e,b,"bordercolor"),fontFamily:h.castHoverOption(e,b,"font.family"),fontSize:h.castHoverOption(e,b,"font.size"),fontColor:h.castHoverOption(e,b,"font.color"),hovertemplate:c.castOption(e,b,"hovertemplate"),hovertemplateLabels:c.extendFlat({},T,x),eventData:[T]},{container:r,gd:t.graphDiv}),u.buttons&&u.distance<5?t.graphDiv.emit("plotly_click",k):t.graphDiv.emit("plotly_hover",k),o=k}else h.loneUnhover(r),t.graphDiv.emit("plotly_unhover",o);t.drawAnnotations(t)}.bind(null,t),t.traces={},t.make4thDimension(),!0}function x(t,e){var r=document.createElement("div"),n=t.container;this.graphDiv=t.graphDiv;var i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.style.position="absolute",i.style.top=i.style.left="0px",i.style.width=i.style.height="100%",i.style["z-index"]=20,i.style["pointer-events"]="none",r.appendChild(i),this.svgContainer=i,r.id=t.id,r.style.position="absolute",r.style.top=r.style.left="0px",r.style.width=r.style.height="100%",n.appendChild(r),this.fullLayout=e,this.id=t.id||"scene",this.fullSceneLayout=e[this.id],this.plotArgs=[[],{},{}],this.axesOptions=v(e,e[this.id]),this.spikeOptions=m(e[this.id]),this.container=r,this.staticMode=!!t.staticPlot,this.pixelRatio=this.pixelRatio||t.plotGlPixelRatio||2,this.dataScale=[1,1,1],this.contourLevels=[[],[],[]],this.convertAnnotations=u.getComponentMethod("annotations3d","convert"),this.drawAnnotations=u.getComponentMethod("annotations3d","draw"),b(this,this.pixelRatio)}var _=x.prototype;_.initializeGLCamera=function(){var t=this.fullSceneLayout.camera,e="orthographic"===t.projection.type;this.camera=a(this.container,{center:[t.center.x,t.center.y,t.center.z],eye:[t.eye.x,t.eye.y,t.eye.z],up:[t.up.x,t.up.y,t.up.z],_ortho:e,zoomMin:.01,zoomMax:100,mode:"orbit"})},_.recoverContext=function(){var t=this,e=this.glplot.gl,r=this.glplot.canvas,n=this.glplot.camera,i=this.glplot.pixelRatio;this.glplot.dispose(),requestAnimationFrame(function a(){e.isContextLost()?requestAnimationFrame(a):b(t,n,i,r)?t.plot.apply(t,t.plotArgs):c.error("Catastrophic and unrecoverable WebGL error. Context lost.")})};var w=["xaxis","yaxis","zaxis"];function A(t,e,r){for(var n=t.fullSceneLayout,i=0;i<3;i++){var a=w[i],o=a.charAt(0),s=n[a],l=e[o],u=e[o+"calendar"],f=e["_"+o+"length"];if(c.isArrayOrTypedArray(l))for(var h,d=0;d<(f||l.length);d++)if(c.isArrayOrTypedArray(l[d]))for(var p=0;pg[1][a])g[0][a]=-1,g[1][a]=1;else{var L=g[1][a]-g[0][a];g[0][a]-=L/32,g[1][a]+=L/32}if("reversed"===s.autorange){var S=g[0][a];g[0][a]=g[1][a],g[1][a]=S}}else{var C=s.range;g[0][a]=s.r2l(C[0]),g[1][a]=s.r2l(C[1])}g[0][a]===g[1][a]&&(g[0][a]-=1,g[1][a]+=1),v[a]=g[1][a]-g[0][a],this.glplot.bounds[0][a]=g[0][a]*h[a],this.glplot.bounds[1][a]=g[1][a]*h[a]}var O=[1,1,1];for(a=0;a<3;++a){var R=m[l=(s=u[w[a]]).type];O[a]=Math.pow(R.acc,1/R.count)/h[a]}var P;if("auto"===u.aspectmode)P=Math.max.apply(null,O)/Math.min.apply(null,O)<=4?O:[1,1,1];else if("cube"===u.aspectmode)P=[1,1,1];else if("data"===u.aspectmode)P=O;else{if("manual"!==u.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var z=u.aspectratio;P=[z.x,z.y,z.z]}u.aspectratio.x=c.aspectratio.x=P[0],u.aspectratio.y=c.aspectratio.y=P[1],u.aspectratio.z=c.aspectratio.z=P[2],this.glplot.aspect=P;var I=u.domain||null,N=e._size||null;if(I&&N){var D=this.container.style;D.position="absolute",D.left=N.l+I.x[0]*N.w+"px",D.top=N.t+(1-I.y[1])*N.h+"px",D.width=N.w*(I.x[1]-I.x[0])+"px",D.height=N.h*(I.y[1]-I.y[0])+"px"}this.glplot.redraw()}},_.destroy=function(){this.glplot&&(this.camera.mouseListener.enabled=!1,this.container.removeEventListener("wheel",this.camera.wheelListener),this.camera=this.glplot.camera=null,this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null)},_.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),M(this.glplot.camera)},_.setCamera=function(t){var e;this.glplot.camera.lookAt.apply(this,[[(e=t).eye.x,e.eye.y,e.eye.z],[e.center.x,e.center.y,e.center.z],[e.up.x,e.up.y,e.up.z]]);var r="orthographic"===t.projection.type;if(r!==this.glplot.camera._ortho){this.glplot.redraw();var n=this.glplot.pixelRatio,i=this.glplot.clearColor;this.glplot.gl.clearColor(i[0],i[1],i[2],i[3]),this.glplot.gl.clear(this.glplot.gl.DEPTH_BUFFER_BIT|this.glplot.gl.COLOR_BUFFER_BIT),this.glplot.dispose(),b(this,n),this.glplot.camera._ortho=r}},_.saveCamera=function(t){var e=this.fullLayout,r=this.getCamera(),n=c.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;function o(t,e,r,n){var i=["up","center","eye"],a=["x","y","z"];return e[i[r]]&&t[i[r]][a[n]]===e[i[r]][a[n]]}if(void 0===i)a=!0;else{for(var s=0;s<3;s++)for(var l=0;l<3;l++)if(!o(r,i,s,l)){a=!0;break}(!i.projection||r.projection&&r.projection.type!==i.projection.type)&&(a=!0)}if(a){var f={};f[this.id+".camera"]=i,u.call("_storeDirectGUIEdit",t,e._preGUI,f),n.set(r),c.nestedProperty(e,this.id+".camera").set(r)}return a},_.updateFx=function(t,e){var r=this.camera;if(r)if("orbit"===t)r.mode="orbit",r.keyBindingMode="rotate";else if("turntable"===t){r.up=[0,0,1],r.mode="turntable",r.keyBindingMode="rotate";var n=this.graphDiv,i=n._fullLayout,a=this.fullSceneLayout.camera,o=a.up.x,s=a.up.y,l=a.up.z;if(l/Math.sqrt(o*o+s*s+l*l)<.999){var f=this.id+".camera.up",h={x:0,y:0,z:1},d={};d[f]=h;var p=n.layout;u.call("_storeDirectGUIEdit",p,i._preGUI,d),a.up=h,c.nestedProperty(p,f).set(h)}}else r.keyBindingMode=t;this.fullSceneLayout.hovermode=e},_.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(n),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,i=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var a=new Uint8Array(r*i*4);e.readPixels(0,0,r,i,e.RGBA,e.UNSIGNED_BYTE,a);for(var o=0,s=i-1;o=e.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=e._paper.attr("width")-7),r.attr(a);var o=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&function(t,e){e.text("");var r=e.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(t._context.linkText+" "+String.fromCharCode(187));if(t._context.sendData)r.on("click",function(){v.sendDataToCloud(t)});else{var n=window.location.pathname.split("/"),i=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+i})}}(t,o),s.text(o.text()&&c.text()?" - ":"")}},v.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL,r=n.select(t).append("div").attr("id","hiddenform").style("display","none"),i=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return i.append("input").attr({type:"text",name:"data"}).node().value=v.graphJson(t,!1,"keepdata"),i.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1};var b=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],x=["year","month","dayMonth","dayMonthYear"];function _(t,e){var r=t._context.locale,n=!1,i={};function o(t){for(var r=!0,a=0;a0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){n=!0}),r.redraw&&t._transitionData._interruptCallbacks.push(function(){return a.call("redraw",t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o=0,s=0;function l(){return o++,function(){var e;s++,n||s!==o||(e=i,t._transitionData&&(function(t){if(t)for(;t.length;)t.shift()}(t._transitionData._interruptCallbacks),Promise.resolve().then(function(){if(r.redraw)return a.call("redraw",t)}).then(function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])}).then(e)))}}r.runFn(l),setTimeout(l())})}],o=l.syncOrAsync(i,t);return o&&o.then||(o=Promise.resolve()),o.then(function(){return t})}function E(t,e){for(var r=0;r1&&R.length>1){for(a.getComponentMethod("grid","sizeDefaults")(u,s),o=0;o15&&R.length>15&&0===s.shapes.length&&0===s.images.length,s._hasCartesian=s._has("cartesian"),s._hasGeo=s._has("geo"),s._hasGL3D=s._has("gl3d"),s._hasGL2D=s._has("gl2d"),s._hasTernary=s._has("ternary"),s._hasPie=s._has("pie"),v.linkSubplots(f,s,c,i),v.cleanPlot(f,s,c,i),p(s,i),s._preGUI||(s._preGUI={}),s._tracePreGUI||(s._tracePreGUI={});var D,F=s._tracePreGUI,j={};for(D in F)j[D]="old";for(o=0;o0){var f=1-2*s;n=Math.round(f*n),a=Math.round(f*a)}}var h=v.layoutAttributes.width.min,d=v.layoutAttributes.height.min;n1,g=!e.height&&Math.abs(r.height-a)>1;(g||p)&&(p&&(r.width=n),g&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),v.sanitizeMargins(r)},v.supplyLayoutModuleDefaults=function(t,e,r,n){var i,o,s,u=a.componentsRegistry,c=e._basePlotModules,f=a.subplotsRegistry.cartesian;for(i in u)(s=u[i]).includeBasePlot&&s.includeBasePlot(t,e);for(var h in c.length||c.push(f),e._has("cartesian")&&(a.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[h].sort(l.subplotSort);for(o=0;o.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0);var l=void 0!==r.xl?r.xl:r.x,u=void 0!==r.xr?r.xr:r.x,c=void 0!==r.yt?r.yt:r.y,f=void 0!==r.yb?r.yb:r.y;i[e]={l:{val:l,size:r.l+o},r:{val:u,size:r.r+o},b:{val:f,size:r.b+o},t:{val:c,size:r.t+o}},a[e]=1}else delete i[e],delete a[e];n._replotting||v.doAutoMargin(t)}},v.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),T(e);var r=e._size,n=JSON.stringify(r),o=e.margin,s=o.l,l=o.r,u=o.t,c=o.b,f=e.width,h=e.height,d=e._pushmargin,p=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var g in d)p[g]||delete d[g];for(var v in d.base={l:{val:0,size:s},r:{val:1,size:l},t:{val:1,size:u},b:{val:0,size:c}},d){var m=d[v].l||{},y=d[v].b||{},b=m.val,x=m.size,_=y.val,w=y.size;for(var A in d){if(i(x)&&d[A].r){var M=d[A].r.val,k=d[A].r.size;if(M>b){var E=(x*M+(k-f)*b)/(M-b),L=(k*(1-b)+(x-f)*(1-M))/(M-b);E>=0&&L>=0&&f-(E+L)>0&&E+L>s+l&&(s=E,l=L)}}if(i(w)&&d[A].t){var S=d[A].t.val,C=d[A].t.size;if(S>_){var O=(w*S+(C-h)*_)/(S-_),R=(C*(1-_)+(w-h)*(1-S))/(S-_);O>=0&&R>=0&&h-(R+O)>0&&O+R>c+u&&(c=O,u=R)}}}}}if(r.l=Math.round(s),r.r=Math.round(l),r.t=Math.round(u),r.b=Math.round(c),r.p=Math.round(o.pad),r.w=Math.round(f)-r.l-r.r,r.h=Math.round(h)-r.t-r.b,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1,a.call("plot",t)},v.graphJson=function(t,e,r,n,i){(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&v.supplyDefaults(t);var a=i?t._fullData:t.data,o=i?t._fullLayout:t.layout,s=(t._transitionData||{})._frames;function u(t){if("function"==typeof t)return null;if(l.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!l.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;i[e]=u(t[e])}return i}return Array.isArray(t)?t.map(u):l.isTypedArray(t)?l.simpleMap(t,l.identity):l.isJSDate(t)?l.ms2DateTimeLocal(+t):t}var c={data:(a||[]).map(function(t){var r=u(t);return e&&delete r.fit,r})};return e||(c.layout=u(o)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),s&&(c.frames=u(s)),"object"===n?c:JSON.stringify(c)},v.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;s--)if(o[s].enabled){r._indexToPoints=o[s]._indexToPoints;break}n&&n.calc&&(a=n.calc(t,r))}Array.isArray(a)&&a[0]||(a=[{x:c,y:c}]),a[0].t||(a[0].t={}),a[0].trace=r,p[e]=a}}for(y&&E(u,h),i=0;i=0?h.angularAxis.domain:n.extent(A),L=Math.abs(A[1]-A[0]);T&&!M&&(L=0);var S=E.slice();k&&M&&(S[1]+=L);var C=h.angularAxis.ticksCount||4;C>8&&(C=C/(C/8)+C%8),h.angularAxis.ticksStep&&(C=(S[1]-S[0])/C);var O=h.angularAxis.ticksStep||(S[1]-S[0])/(C*(h.minorTicks+1));w&&(O=Math.max(Math.round(O),1)),S[2]||(S[2]=O);var R=n.range.apply(this,S);if(R=R.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(S.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=k?L:0,"undefined"==typeof(t=n.select(this).select("svg.chart-root"))||t.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),z=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));t=n.select(z)}t.select(".guides-group").style({"pointer-events":"none"}),t.select(".angular.axis-group").style({"pointer-events":"none"}),t.select(".radial.axis-group").style({"pointer-events":"none"});var I,N=t.select(".chart-group"),D={fill:"none",stroke:h.tickColor},F={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){I=t.select(".legend-group").attr({transform:"translate("+[b,h.margin.top]+")"}).style({display:"block"});var j=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:I,elements:j,reverseOrder:h.legend.reverseOrder})})();var B=I.node().getBBox();b=Math.min(h.width-B.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,b=Math.max(10,b),_=[h.margin.left+b,h.margin.top+b],r.range([0,b]),c.layout.radialAxis.domain=r.domain(),I.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else I=t.select(".legend-group").style({display:"none"});t.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(h.width-(h.margin.left+h.margin.right+2*b+(B?B.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*b))/2];if(U[0]=Math.max(0,U[0]),U[1]=Math.max(0,U[1]),t.select(".outer-group").attr("transform","translate("+U+")"),h.title&&h.title.text){var V=t.select("g.title-group text").style(F).text(h.title.text),H=V.node().getBBox();V.attr({x:_[0]-H.width/2,y:_[1]-b-20})}var q=t.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var G=q.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(D),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:b}).style(D);var X=t.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});function W(t,e){return s(t)%360+h.orientation}if(h.radialAxis.visible){var Y=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(Y).attr({transform:"rotate("+h.radialAxis.orientation+")"}),q.selectAll(".domain").style(D),q.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(F).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,F["font-size"]]+")":"translate("+[0,F["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var Z=t.select(".angular.axis-group").selectAll("g.angular-tick").data(R),Q=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+W(t)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),Z.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(D),Q.selectAll(".minor").style({stroke:h.minorTickColor}),Z.select("line.grid-line").attr({x1:h.tickLength?b-h.tickLength:0,x2:b}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(F);var $=Z.select("text.axis-text").attr({x:b+h.labelOffset,dy:a+"em",transform:function(t,e){var r=W(t),n=b+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:h.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(h.minorTicks+1)!=0?"":w?w[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(F);h.angularAxis.rewriteTicks&&$.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var J=n.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[b+J,h.margin.top]+")"});var K=t.select("g.geometry-group").selectAll("g").size()>0,tt=t.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||K){var et=[];d.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=s,n.container=tt.filter(function(t,r){return r==e}),n.geometry=t.geometry,n.orientation=h.orientation,n.direction=h.direction,n.index=e,et.push({data:t,geometryConfig:n})});var rt=n.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return i(o[r].defaultConfig(),t)});o[r]().config(n)()})}var it,at,ot=t.select(".guides-group"),st=t.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!M){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});N.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(X).angle;ft.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;it=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(it)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(X).radius;ht.attr({r:n}).style({opacity:.5}),at=r.invert(o.util.getMousePos(X).radius);var i=o.util.convertToCartesian(n,h.radialAxis.orientation);ut.text(o.util.round(at)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ht.style({opacity:0}),ct.hide(),lt.hide(),ut.hide()}),t.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(e,r){var i=n.select(this),a=this.style.fill,s="black",l=this.style.opacity||1;if(i.attr({"data-opacity":l}),a&&"none"!==a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var u={t:o.util.round(e[0]),r:o.util.round(e[1])};M&&(u.t=w[e[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=t.node().getBoundingClientRect(),d=[f.left+f.width/2-U[0]-h.left,f.top+f.height/2-U[1]-h.top];ct.config({color:s}).text(c),ct.move(d)}else a=this.style.stroke||"black",i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.hide();var r=n.select(this),i=r.attr("data-fill");i?r.style({fill:i,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})})}(u),this},h.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),i(l.data[e],o.Axis.defaultConfig().data[0]),i(l.data[e],t)}),i(l.layout,o.Axis.defaultConfig().layout),i(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return r},h.angularScale=function(t){return s},h.svg=function(){return t},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var i=e||6,a=[],o=[];n.range(0,360+i,i).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],i=e[1],a={};return a.x=r,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+i*i),a},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i0)){var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:c(s),transform:function(t,r){return"rotate("+(e.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return p.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return p.stroke(r,i,a)},"stroke-width":function(t,e){return p["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return p["stroke-dasharray"](r,i,a)},opacity:function(t,e){return p.opacity(r,i,a)},display:function(t,e){return p.display(r,i,a)}})}};var f=e.angularScale.range(),h=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,d=n.svg.arc().startAngle(function(t){return-h/2}).endAngle(function(t){return h/2}).innerRadius(function(t){return e.radialScale(l+(t[2]||0))}).outerRadius(function(t){return e.radialScale(l+(t[2]||0))+e.radialScale(t[1])});u.arc=function(t,r,i){n.select(this).attr({class:"mark arc",d:d,transform:function(t,r){return"rotate("+(e.orientation+s(t[0])+90)+")"}})};var p={fill:function(e,r,n){return t[n].data.color},stroke:function(e,r,n){return t[n].data.strokeColor},"stroke-width":function(e,r,n){return t[n].data.strokeSize+"px"},"stroke-dasharray":function(e,n,i){return r[t[i].data.strokeDash]},opacity:function(e,r,n){return t[n].data.opacity},display:function(e,r,n){return"undefined"==typeof t[n].data.visible||t[n].data.visible?"block":"none"}},g=n.select(this).selectAll("g.layer").data(o);g.enter().append("g").attr({class:"layer"});var v=g.selectAll("path.mark").data(function(t,e){return t});v.enter().append("path").attr({class:"mark"}),v.style(p).each(u[e.geometryType]),v.exit().remove(),g.exit().remove()})}return a.config=function(e){return arguments.length?(e.forEach(function(e,r){t[r]||(t[r]={}),i(t[r],o.PolyChart.defaultConfig()),i(t[r],e)}),this):t},a.getColorScale=function(){},n.rebind(a,e,"on"),a},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){var t=o.Legend.defaultConfig(),e=n.dispatch("hover");function r(){var e=t.legendConfig,a=t.data.map(function(t,r){return[].concat(t).map(function(t,n){var a=i({},e.elements[r]);return a.name=t,a.color=[].concat(e.elements[r].color)[n],a})}),o=n.merge(a);o=o.filter(function(t,r){return e.elements[r]&&(e.elements[r].visibleInLegend||"undefined"==typeof e.elements[r].visibleInLegend)}),e.reverseOrder&&(o=o.reverse());var s=e.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),u=e.fontSize,c=null==e.isContinuous?"number"==typeof o[0]:e.isContinuous,f=c?e.height:u*o.length,h=s.classed("legend-group",!0).selectAll("svg").data([0]),d=h.enter().append("svg").attr({width:300,height:f+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});d.append("g").classed("legend-axis",!0),d.append("g").classed("legend-marks",!0);var p=n.range(o.length),g=n.scale[c?"linear":"ordinal"]().domain(p).range(l),v=n.scale[c?"linear":"ordinal"]().domain(p)[c?"range":"rangePoints"]([0,f]);if(c){var m=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);m.enter().append("stop"),m.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:e.height,width:e.colorBandWidth,fill:"url(#grad1)"})}else{var y=h.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(t,e){return"translate("+[u/2,v(e)+u/2]+")"},d:function(t,e){var r,i,a,o=t.symbol;return a=3*(i=u),"line"===(r=o)?"M"+[[-i/2,-i/12],[i/2,-i/12],[i/2,i/12],[-i/2,i/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(a)():n.svg.symbol().type("square").size(a)()},fill:function(t,e){return g(e)}}),y.exit().remove()}var b=n.svg.axis().scale(v).orient("right"),x=h.select("g.legend-axis").attr({transform:"translate("+[c?e.colorBandWidth:u,u/2]+")"}).call(b);return x.selectAll(".domain").style({fill:"none",stroke:"none"}),x.selectAll("line").style({fill:"none",stroke:c?e.textColor:"none"}),x.selectAll("text").style({fill:e.textColor,"font-size":e.fontSize}).text(function(t,e){return o[e].name}),r}return r.config=function(e){return arguments.length?(i(t,e),this):t},n.rebind(r,e,"on"),r},o.Legend.defaultConfig=function(t,e){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){var n=(t=a.container.selectAll("g."+s).data([0])).enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=n.append("text").attr({dx:a.padding+l,dy:.3*+a.fontSize}),u};return u.text=function(i){var o=n.hsl(a.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=i||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(f);var h=a.padding,d=e.node().getBBox(),p={fill:a.color,stroke:s,"stroke-width":"2px"},g=d.width+2*h+l,v=d.height+2*h;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[a.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*h]+")"}),t.style({display:"block"}),u},u.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),u},u.hide=function(){if(t)return t.style({display:"none"}),u},u.show=function(){if(t)return t.style({display:"block"}),u},u.config=function(t){return i(a,t),u},u},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={convert:function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=i({},t);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var s=i({},t.layout);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r}};return t}},{"../../../constants/alignment":471,"../../../lib":495,d3:81}],589:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../../lib"),a=t("../../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=i.extendDeepAll,u=e.exports={};u.framework=function(t){var e,r,i,a,c,f=new s;function h(r,s){return s&&(c=s),n.select(n.select(c).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),e=e?l(e,r):r,i||(i=o.Axis()),a=o.adapter.plotly().convert(e),i.config(a).render(c),t.data=e.data,t.layout=e.layout,u.fillLayout(t),e}return h.isPolar=!0,h.svg=function(){return i.svg()},h.getConfig=function(){return e},h.getLiveConfig=function(){return o.adapter.plotly().convert(i.getLiveConfig(),!0)},h.getLiveScales=function(){return{t:i.angularScale(),r:i.radialScale()}},h.setUndoPoint=function(){var t,n,i=this,a=o.util.cloneJson(e);t=a,n=r,f.add({undo:function(){n&&i(n)},redo:function(){i(t)}}),r=o.util.cloneJson(a)},h.undo=function(){f.undo()},h.redo=function(){f.redo()},h},u.fillLayout=function(t){var e=n.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),i=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:a.background,_container:e,_paperdiv:r,_paper:i};t._fullLayout=l(o,t.layout)}},{"../../../components/color":376,"../../../lib":495,"./micropolar":588,"./undo_manager":590,d3:81}],590:[function(t,e,r){"use strict";e.exports=function(){var t,e=[],r=-1,n=!1;function i(t,e){return t?(n=!0,t[e](),n=!1,this):this}return{add:function(t){return n?this:(e.splice(r+1,e.length-r),e.push(t),r=e.length-1,this)},setCallback:function(e){t=e},undo:function(){var n=e[r];return n?(i(n,"undo"),r-=1,t&&t(n.undo),this):this},redo:function(){var n=e[r+1];return n?(i(n,"redo"),r+=1,t&&t(n.redo),this):this},clear:function(){e=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r-1&&(c[h[r]].title={text:""});for(r=0;rpath, .legendlines>path, .cbfill").each(function(){var t=n.select(this),e=this.style.fill;e&&-1!==e.indexOf("url(")&&t.style("fill",e.replace(l,"TOBESTRIPPED"));var r=this.style.stroke;r&&-1!==r.indexOf("url(")&&t.style("stroke",r.replace(l,"TOBESTRIPPED"))}),"pdf"!==e&&"eps"!==e||h.selectAll("#MathJax_SVG_glyphs path").attr("stroke-width",0),h.node().setAttributeNS(s.xmlns,"xmlns",s.svg),h.node().setAttributeNS(s.xmlns,"xmlns:xlink",s.xlink),"svg"===e&&r&&(h.attr("width",r*p),h.attr("height",r*g),h.attr("viewBox","0 0 "+p+" "+g));var _=(new window.XMLSerializer).serializeToString(h.node());return _=function(t){var e=n.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":-1!==t.indexOf("<")||-1!==t.indexOf(">")?"":e.html(t).text()});return e.remove(),r}(_),_=(_=_.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(u,"'"),i.isIE()&&(_=(_=(_=_.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),_}},{"../components/color":376,"../components/drawing":397,"../constants/xmlns_namespaces":476,"../lib":495,d3:81}],601:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../components/colorbar/attributes"),a=t("../../components/fx/hovertemplate_attributes"),o=t("../mesh3d/attributes"),s=t("../../plots/attributes"),l=t("../../lib/extend").extendFlat,u={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},z:{valType:"data_array",editType:"calc+clearAxisTypes"},u:{valType:"data_array",editType:"calc"},v:{valType:"data_array",editType:"calc"},w:{valType:"data_array",editType:"calc"},sizemode:{valType:"enumerated",values:["scaled","absolute"],editType:"calc",dflt:"scaled"},sizeref:{valType:"number",editType:"calc",min:0},anchor:{valType:"enumerated",editType:"calc",values:["tip","tail","cm","center"],dflt:"cm"},text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertemplate:a({editType:"calc"},{keys:["norm"]})};l(u,n("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}),{colorbar:i});["opacity","lightposition","lighting"].forEach(function(t){u[t]=o[t]}),u.hoverinfo=l({},s.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","text","name"],dflt:"x+y+z+norm+text+name"}),u.transforms=void 0,e.exports=u},{"../../components/colorbar/attributes":377,"../../components/colorscale/attributes":383,"../../components/fx/hovertemplate_attributes":414,"../../lib/extend":488,"../../plots/attributes":538,"../mesh3d/attributes":608}],602:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){for(var r=e.u,i=e.v,a=e.w,o=Math.min(e.x.length,e.y.length,e.z.length,r.length,i.length,a.length),s=-1/0,l=1/0,u=0;u=0;o--)(s=((f[[(r=(a=h[o])[0])-1,i=a[1]]]||g)[2]+(f[[r+1,i]]||g)[2]+(f[[r,i-1]]||g)[2]+(f[[r,i+1]]||g)[2])/20)&&(l[a]=[r,i,s],h.splice(o,1),u=!0);if(!u)throw"findEmpties iterated with no new neighbors";for(a in l)f[a]=l[a],c.push(l[a])}return c.sort(function(t,e){return e[2]-t[2]})}},{"../../lib":495}],607:[function(t,e,r){"use strict";var n=t("../../lib"),i=[[-1,0],[1,0],[0,-1],[0,1]];function a(t){return.5-.25*Math.min(1,.5*t)}function o(t,e,r){var n,a,o,s,l,u,c,f,h,d,p,g,v,m=0;for(s=0;sg&&(m=Math.max(m,Math.abs(t[a][o]-p)/(v-g))))}return m}e.exports=function(t,e){var r,i=1;for(o(t,e),r=0;r.01;r++)i=o(t,e,a(i));return i>.01&&n.log("interp2d didn't converge quickly",i),t}},{"../../lib":495}],608:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../components/colorbar/attributes"),a=t("../../components/fx/hovertemplate_attributes"),o=t("../surface/attributes"),s=t("../../plots/attributes"),l=t("../../lib/extend").extendFlat;e.exports=l({x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},z:{valType:"data_array",editType:"calc+clearAxisTypes"},i:{valType:"data_array",editType:"calc"},j:{valType:"data_array",editType:"calc"},k:{valType:"data_array",editType:"calc"},text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertemplate:a({editType:"calc"}),delaunayaxis:{valType:"enumerated",values:["x","y","z"],dflt:"z",editType:"calc"},alphahull:{valType:"number",dflt:-1,editType:"calc"},intensity:{valType:"data_array",editType:"calc"},color:{valType:"color",editType:"calc"},vertexcolor:{valType:"data_array",editType:"calc"},facecolor:{valType:"data_array",editType:"calc"},transforms:void 0},n("",{colorAttr:"`intensity`",showScaleDflt:!0,editTypeOverride:"calc"}),{colorbar:i,opacity:o.opacity,flatshading:{valType:"boolean",dflt:!1,editType:"calc"},contour:{show:l({},o.contours.x.show,{}),color:o.contours.x.color,width:o.contours.x.width,editType:"calc"},lightposition:{x:l({},o.lightposition.x,{dflt:1e5}),y:l({},o.lightposition.y,{dflt:1e5}),z:l({},o.lightposition.z,{dflt:0}),editType:"calc"},lighting:l({vertexnormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-12,editType:"calc"},facenormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-6,editType:"calc"},editType:"calc"},o.lighting),hoverinfo:l({},s.hoverinfo,{editType:"calc"})})},{"../../components/colorbar/attributes":377,"../../components/colorscale/attributes":383,"../../components/fx/hovertemplate_attributes":414,"../../lib/extend":488,"../../plots/attributes":538,"../surface/attributes":654}],609:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.intensity&&n(t,e,{vals:e.intensity,containerStr:"",cLetter:"c"})}},{"../../components/colorscale/calc":384}],610:[function(t,e,r){"use strict";var n=t("gl-mesh3d"),i=t("delaunay-triangulate"),a=t("alpha-shape"),o=t("convex-hull"),s=t("../../lib/gl_format_color").parseColorScale,l=t("../../lib/str2rgbarray"),u=t("../../plots/gl3d/zip3");function c(t,e,r){this.scene=t,this.uid=r,this.mesh=e,this.name="",this.color="#fff",this.data=null,this.showContour=!1}var f=c.prototype;function h(t){for(var e=[],r=t.length,n=0;n=e-.5)return!1;return!0}f.handlePick=function(t){if(t.object===this.mesh){var e=t.index=t.data.index;t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]];var r=this.data.hovertext||this.data.text;return Array.isArray(r)&&void 0!==r[e]?t.textLabel=r[e]:r&&(t.textLabel=r),!0}},f.update=function(t){var e=this.scene,r=e.fullSceneLayout;this.data=t;var n,c=t.x.length,f=u(d(r.xaxis,t.x,e.dataScale[0],t.xcalendar),d(r.yaxis,t.y,e.dataScale[1],t.ycalendar),d(r.zaxis,t.z,e.dataScale[2],t.zcalendar));if(t.i&&t.j&&t.k){if(t.i.length!==t.j.length||t.j.length!==t.k.length||!g(t.i,c)||!g(t.j,c)||!g(t.k,c))return;n=u(p(t.i),p(t.j),p(t.k))}else n=0===t.alphahull?o(f):t.alphahull>0?a(t.alphahull,f):function(t,e){for(var r=["x","y","z"].indexOf(t),n=[],a=e.length,o=0;os&&T[v].gap;)v--;for(y=T[v].s,p=T.length-1;p>v;p--)T[p].s=y;for(;sk[c]&&c=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],623:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry"),a=t("./attributes"),o=t("./constants"),s=t("./subtypes"),l=t("./xy_defaults"),u=t("./stack_defaults"),c=t("./marker_defaults"),f=t("./line_defaults"),h=t("./line_shape_defaults"),d=t("./text_defaults"),p=t("./fillcolor_defaults");e.exports=function(t,e,r,g){function v(r,i){return n.coerce(t,e,a,r,i)}var m=l(t,e,g,v);if(m||(e.visible=!1),e.visible){var y=u(t,e,g,v),b=!y&&mG!=(D=R[C][1])>=G&&(z=R[C-1][0],I=R[C][0],D-N&&(P=z+(I-z)*(G-N)/(D-N),U=Math.min(U,P),V=Math.max(V,P)));U=Math.max(U,0),V=Math.min(V,h._length);var X=s.defaultLine;return s.opacity(f.fillcolor)?X=f.fillcolor:s.opacity((f.line||{}).color)&&(X=f.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:U,x1:V,y0:G,y1:G,color:X,hovertemplate:!1}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":376,"../../components/fx":415,"../../lib":495,"../../registry":592,"./fill_hover_text":624,"./get_trace_color":626}],628:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.crossTraceDefaults=t("./cross_trace_defaults"),n.calc=t("./calc").calc,n.crossTraceCalc=t("./cross_trace_calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./marker_colorbar"),n.style=t("./style").style,n.styleOnSelect=t("./style").styleOnSelect,n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],n.meta={},e.exports=n},{"../../plots/cartesian":552,"./arrays_to_calcdata":615,"./attributes":616,"./calc":617,"./cross_trace_calc":621,"./cross_trace_defaults":622,"./defaults":623,"./hover":627,"./marker_colorbar":634,"./plot":636,"./select":637,"./style":639,"./subtypes":640}],629:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,i=t("../../components/colorscale/helpers").hasColorscale,a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,s,l){var u=(t.marker||{}).color;(s("line.color",r),i(t,"line"))?a(t,e,o,s,{prefix:"line.",cLetter:"c"}):s("line.color",!n(u)&&u||r);s("line.width"),(l||{}).noDash||s("line.dash")}},{"../../components/colorscale/defaults":386,"../../components/colorscale/helpers":387,"../../lib":495}],630:[function(t,e,r){"use strict";var n=t("../../constants/numerical"),i=n.BADNUM,a=n.LOG_CLIP,o=a+.5,s=a-.5,l=t("../../lib"),u=l.segmentsIntersect,c=l.constrain,f=t("./constants");e.exports=function(t,e){var r,n,a,h,d,p,g,v,m,y,b,x,_,w,A,M,T,k,E=e.xaxis,L=e.yaxis,S="log"===E.type,C="log"===L.type,O=E._length,R=L._length,P=e.connectGaps,z=e.baseTolerance,I=e.shape,N="linear"===I,D=e.fill&&"none"!==e.fill,F=[],j=f.minTolerance,B=t.length,U=new Array(B),V=0;function H(e){var r=t[e];if(!r)return!1;var n=E.c2p(r.x),a=L.c2p(r.y);if(n===i){if(S&&(n=E.c2p(r.x,!0)),n===i)return!1;C&&a===i&&(n*=Math.abs(E._m*R*(E._m>0?o:s)/(L._m*O*(L._m>0?o:s)))),n*=1e3}if(a===i){if(C&&(a=L.c2p(r.y,!0)),a===i)return!1;a*=1e3}return[n,a]}function q(t,e,r,n){var i=r-t,a=n-e,o=.5-t,s=.5-e,l=i*i+a*a,u=i*o+a*s;if(u>0&&urt||t[1]it)return[c(t[0],et,rt),c(t[1],nt,it)]}function st(t,e){return t[0]===e[0]&&(t[0]===et||t[0]===rt)||(t[1]===e[1]&&(t[1]===nt||t[1]===it)||void 0)}function lt(t,e,r){return function(n,i){var a=ot(n),o=ot(i),s=[];if(a&&o&&st(a,o))return s;a&&s.push(a),o&&s.push(o);var u=2*l.constrain((n[t]+i[t])/2,e,r)-((a||n)[t]+(o||i)[t]);u&&((a&&o?u>0==a[t]>o[t]?a:o:a||o)[t]+=u);return s}}function ut(t){var e=t[0],r=t[1],n=e===U[V-1][0],i=r===U[V-1][1];if(!n||!i)if(V>1){var a=e===U[V-2][0],o=r===U[V-2][1];n&&(e===et||e===rt)&&a?o?V--:U[V-1]=t:i&&(r===nt||r===it)&&o?a?V--:U[V-1]=t:U[V++]=t}else U[V++]=t}function ct(t){U[V-1][0]!==t[0]&&U[V-1][1]!==t[1]&&ut([Z,Q]),ut(t),$=null,Z=Q=0}function ft(t){if(T=t[0]/O,k=t[1]/R,W=t[0]rt?rt:0,Y=t[1]it?it:0,W||Y){if(V)if($){var e=K($,t);e.length>1&&(ct(e[0]),U[V++]=e[1])}else J=K(U[V-1],t)[0],U[V++]=J;else U[V++]=[W||t[0],Y||t[1]];var r=U[V-1];W&&Y&&(r[0]!==W||r[1]!==Y)?($&&(Z!==W&&Q!==Y?ut(Z&&Q?(n=$,a=(i=t)[0]-n[0],o=(i[1]-n[1])/a,(n[1]*i[0]-i[1]*n[0])/a>0?[o>0?et:rt,it]:[o>0?rt:et,nt]):[Z||W,Q||Y]):Z&&Q&&ut([Z,Q])),ut([W,Y])):Z-W&&Q-Y&&ut([W||Z,Y||Q]),$=t,Z=W,Q=Y}else $&&ct(K($,t)[0]),U[V++]=t;var n,i,a,o}for("linear"===I||"spline"===I?K=function(t,e){for(var r=[],n=0,i=0;i<4;i++){var a=at[i],o=u(t[0],t[1],e[0],e[1],a[0],a[1],a[2],a[3]);o&&(!n||Math.abs(o.x-r[0][0])>1||Math.abs(o.y-r[0][1])>1)&&(o=[o.x,o.y],n&&X(o,t)G(p,ht))break;a=p,(_=m[0]*v[0]+m[1]*v[1])>b?(b=_,h=p,g=!1):_=t.length||!p)break;ft(p),n=p}}else ft(h)}$&&ut([Z||$[0],Q||$[1]]),F.push(U.slice(0,V))}return F}},{"../../constants/numerical":475,"../../lib":495,"./constants":620}],631:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],632:[function(t,e,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};e.exports=function(t,e,r){var i,a,o,s,l,u={},c=!1,f=-1,h=0,d=-1;for(a=0;a=0?l=d:(l=d=h,h++),l0?Math.max(e,i):0}}},{"fast-isnumeric":90}],634:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],635:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/helpers").hasColorscale,a=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l,u){var c=o.isBubble(t),f=(t.line||{}).color;(u=u||{},f&&(r=f),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noSelect||(l("selected.marker.color"),l("unselected.marker.color"),l("selected.marker.size"),l("unselected.marker.size")),u.noLine||(l("marker.line.color",f&&!Array.isArray(f)&&e.marker.color!==f?f:c?n.background:n.defaultLine),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0)),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient)&&("none"!==l("marker.gradient.type")&&l("marker.gradient.color"))}},{"../../components/color":376,"../../components/colorscale/defaults":386,"../../components/colorscale/helpers":387,"./subtypes":640}],636:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../registry"),a=t("../../lib"),o=a.ensureSingle,s=a.identity,l=t("../../components/drawing"),u=t("./subtypes"),c=t("./line_points"),f=t("./link_traces"),h=t("../../lib/polygon").tester;function d(t,e,r,f,d,p,g){var v;!function(t,e,r,i,o){var s=r.xaxis,l=r.yaxis,c=n.extent(a.simpleMap(s.range,s.r2c)),f=n.extent(a.simpleMap(l.range,l.r2c)),h=i[0].trace;if(!u.hasMarkers(h))return;var d=h.marker.maxdisplayed;if(0===d)return;var p=i.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/d),v=0;o.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(t){return m?t.transition():t}var b=r.xaxis,x=r.yaxis,_=f[0].trace,w=_.line,A=n.select(p),M=o(A,"g","errorbars"),T=o(A,"g","lines"),k=o(A,"g","points"),E=o(A,"g","text");if(i.getComponentMethod("errorbars","plot")(t,M,r,g),!0===_.visible){var L,S;y(A).style("opacity",_.opacity);var C=_.fill.charAt(_.fill.length-1);"x"!==C&&"y"!==C&&(C=""),r.isRangePlot||(f[0].node3=A);var O,R,P="",z=[],I=_._prevtrace;I&&(P=I._prevRevpath||"",S=I._nextFill,z=I._polygons);var N,D,F,j,B,U,V,H="",q="",G=[],X=a.noop;if(L=_._ownFill,u.hasLines(_)||"none"!==_.fill){for(S&&S.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(N=l.steps(w.shape),D=l.steps(w.shape.split("").reverse().join(""))):N=D="spline"===w.shape?function(t){var e=t[t.length-1];return t.length>1&&t[0][0]===e[0]&&t[0][1]===e[1]?l.smoothclosed(t.slice(1),w.smoothing):l.smoothopen(t,w.smoothing)}:function(t){return"M"+t.join("L")},F=function(t){return D(t.reverse())},G=c(f,{xaxis:b,yaxis:x,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),V=_._polygons=new Array(G.length),v=0;v1){var r=n.select(this);if(r.datum(f),t)y(r.style("opacity",0).attr("d",O).call(l.lineGroupStyle)).style("opacity",1);else{var i=y(r);i.attr("d",O),l.singleLineStyle(f,i)}}}}}var W=T.selectAll(".js-line").data(G);y(W.exit()).style("opacity",0).remove(),W.each(X(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(X(!0)),l.setClipUrl(W,r.layerClipId,t),G.length?(L?(L.datum(f),j&&U&&(C?("y"===C?j[1]=U[1]=x.c2p(0,!0):"x"===C&&(j[0]=U[0]=b.c2p(0,!0)),y(L).attr("d","M"+U+"L"+j+"L"+H.substr(1)).call(l.singleFillStyle)):y(L).attr("d",H+"Z").call(l.singleFillStyle))):S&&("tonext"===_.fill.substr(0,6)&&H&&P?("tonext"===_.fill?y(S).attr("d",H+"Z"+P+"Z").call(l.singleFillStyle):y(S).attr("d",H+"L"+P.substr(1)+"Z").call(l.singleFillStyle),_._polygons=_._polygons.concat(z)):(Z(S),_._polygons=null)),_._prevRevpath=q,_._prevPolygons=V):(L?Z(L):S&&Z(S),_._polygons=_._prevRevpath=_._prevPolygons=null),k.datum(f),E.datum(f),function(e,i,a){var o,c=a[0].trace,f=u.hasMarkers(c),h=u.hasText(c),d=tt(c),p=et,g=et;if(f||h){var v=s,_=c.stackgroup,w=_&&"infer zero"===t._fullLayout._scatterStackOpts[b._id+x._id][_].stackgaps;c.marker.maxdisplayed||c._needsCull?v=w?$:Q:_&&!w&&(v=J),f&&(p=v),h&&(g=v)}var A,M=(o=e.selectAll("path.point").data(p,d)).enter().append("path").classed("point",!0);m&&M.call(l.pointStyle,c,t).call(l.translatePoints,b,x).style("opacity",0).transition().style("opacity",1),o.order(),f&&(A=l.makePointStyleFns(c)),o.each(function(e){var i=n.select(this),a=y(i);l.translatePoint(e,a,b,x)?(l.singlePointStyle(e,a,c,A,t),r.layerClipId&&l.hideOutsideRangePoint(e,a,b,x,c.xcalendar,c.ycalendar),c.customdata&&i.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()}),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=i.selectAll("g").data(g,d)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each(function(t){var e=n.select(this),i=y(e.select("text"));l.translatePoint(t,i,b,x)?r.layerClipId&&l.hideOutsideRangePoint(t,e,b,x,c.xcalendar,c.ycalendar):e.remove()}),o.selectAll("text").call(l.textPointStyle,c,t).each(function(t){var e=b.c2p(t.x),r=x.c2p(t.y);n.select(this).selectAll("tspan.line").each(function(){y(n.select(this)).attr({x:e,y:r})})}),o.exit().remove()}(k,E,f);var Y=!1===_.cliponaxis?null:r.layerClipId;l.setClipUrl(k,Y,t),l.setClipUrl(E,Y,t)}function Z(t){y(t).attr("d","M0,0Z")}function Q(t){return t.filter(function(t){return!t.gap&&t.vis})}function $(t){return t.filter(function(t){return t.vis})}function J(t){return t.filter(function(t){return!t.gap})}function K(t){return t.id}function tt(t){if(t.ids)return K}function et(){return!1}}e.exports=function(t,e,r,i,a,u){var c,h,p=!a,g=!!a&&a.duration>0,v=f(t,e,r);((c=i.selectAll("g.trace").data(v,function(t){return t[0].trace.uid})).enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),c.order(),function(t,e,r){e.each(function(e){var i=o(n.select(this),"g","fills");l.setClipUrl(i,r.layerClipId,t);var a=e[0].trace,u=[];a._ownfill&&u.push("_ownFill"),a._nexttrace&&u.push("_nextFill");var c=i.selectAll("g").data(u,s);c.enter().append("g"),c.exit().each(function(t){a[t]=null}).remove(),c.order().each(function(t){a[t]=o(n.select(this),"path","js-fill")})})}(t,c,e),g)?(u&&(h=u()),n.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).each(function(){i.selectAll("g.trace").each(function(r,n){d(t,n,e,r,v,this,a)})})):c.each(function(r,n){d(t,n,e,r,v,this,a)});p&&c.exit().remove(),i.selectAll("path:not([d])").remove()}},{"../../components/drawing":397,"../../lib":495,"../../lib/polygon":507,"../../registry":592,"./line_points":630,"./link_traces":632,"./subtypes":640,d3:81}],637:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],f=s[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===e)for(r=0;r0){var h=i.c2l(c);i._lowerLogErrorBound||(i._lowerLogErrorBound=h),i._lowerErrorBound=Math.min(i._lowerLogErrorBound,h)}}else o[s]=[-l[0]*r,l[1]*r]}return o}e.exports=function(t,e,r){var n=[i(t.x,t.error_x,e[0],r.xaxis),i(t.y,t.error_y,e[1],r.yaxis),i(t.z,t.error_z,e[2],r.zaxis)],a=function(t){for(var e=0;e-1?-1:t.indexOf("right")>-1?1:0}function y(t){return null==t?0:t.indexOf("top")>-1?-1:t.indexOf("bottom")>-1?1:0}function b(t,e){return e(4*t)}function x(t){return d[t]}function _(t,e,r,n,i){var a=null;if(l.isArrayOrTypedArray(t)){a=[];for(var o=0;o=0){var g=function(t,e,r){var n,i=(r+1)%3,a=(r+2)%3,o=[],l=[];for(n=0;n=0&&f("surfacecolor",h||d);for(var p=["x","y","z"],g=0;g<3;++g){var v="projection."+p[g];f(v+".show")&&(f(v+".opacity"),f(v+".scale"))}var m=n.getComponentMethod("errorbars","supplyDefaults");m(t,e,h||d||r,{axis:"z"}),m(t,e,h||d||r,{axis:"y",inherit:"z"}),m(t,e,h||d||r,{axis:"x",inherit:"z"})}else e.visible=!1}},{"../../lib":495,"../../registry":592,"../scatter/line_defaults":629,"../scatter/marker_defaults":635,"../scatter/subtypes":640,"../scatter/text_defaults":641,"./attributes":643}],648:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl3d_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=[{container:"marker",min:"cmin",max:"cmax"},{container:"line",min:"cmin",max:"cmax"}],n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","showLegend"],n.meta={},e.exports=n},{"../../constants/gl3d_markers":473,"../../plots/gl3d":570,"./attributes":643,"./calc":644,"./convert":646,"./defaults":647}],649:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../components/colorbar/attributes"),a=t("../../components/fx/hovertemplate_attributes"),o=t("../mesh3d/attributes"),s=t("../../plots/attributes"),l=t("../../lib/extend").extendFlat,u={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},z:{valType:"data_array",editType:"calc+clearAxisTypes"},u:{valType:"data_array",editType:"calc"},v:{valType:"data_array",editType:"calc"},w:{valType:"data_array",editType:"calc"},starts:{x:{valType:"data_array",editType:"calc"},y:{valType:"data_array",editType:"calc"},z:{valType:"data_array",editType:"calc"},editType:"calc"},maxdisplayed:{valType:"integer",min:0,dflt:1e3,editType:"calc"},sizeref:{valType:"number",editType:"calc",min:0,dflt:1},text:{valType:"string",dflt:"",editType:"calc"},hovertext:{valType:"string",dflt:"",editType:"calc"},hovertemplate:a({editType:"calc"},{keys:["tubex","tubey","tubez","tubeu","tubev","tubew","norm","divergence"]})};l(u,n("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}),{colorbar:i});["opacity","lightposition","lighting"].forEach(function(t){u[t]=o[t]}),u.hoverinfo=l({},s.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","divergence","text","name"],dflt:"x+y+z+norm+text+name"}),u.transforms=void 0,e.exports=u},{"../../components/colorbar/attributes":377,"../../components/colorscale/attributes":383,"../../components/fx/hovertemplate_attributes":414,"../../lib/extend":488,"../../plots/attributes":538,"../mesh3d/attributes":608}],650:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){var r,i,a,o,s=e.u,l=e.v,u=e.w,c=e.x,f=e.y,h=e.z,d=Math.min(c.length,f.length,h.length,s.length,l.length,u.length),p=0;e.starts&&(i=e.starts.x||[],a=e.starts.y||[],o=e.starts.z||[],p=Math.min(i.length,a.length,o.length));var g=0,v=1/0;for(r=0;r2?t.slice(1,e-1):2===e?[(t[0]+t[1])/2]:t}function d(t){var e=t.length;return 1===e?[.5,.5]:[t[1]-t[0],t[e-1]-t[e-2]]}function p(t,e){var r=t.fullSceneLayout,i=t.dataScale,u=e._len,c={};function p(t,e){var n=r[e],o=i[l[e]];return a.simpleMap(t,function(t){return n.d2l(t)*o})}c.vectors=s(p(e.u,"xaxis"),p(e.v,"yaxis"),p(e.w,"zaxis"),u);var g=f(e.x.slice(0,u)),v=f(e.y.slice(0,u)),m=f(e.z.slice(0,u));if(g.length*v.length*m.length>u)return{positions:[],cells:[]};var y=p(g,"xaxis"),b=p(v,"yaxis"),x=p(m,"zaxis");if(c.meshgrid=[y,b,x],e.starts){var _=e._slen;c.startingPositions=s(p(e.starts.x.slice(0,_),"xaxis"),p(e.starts.y.slice(0,_),"yaxis"),p(e.starts.z.slice(0,_),"zaxis"))}else{for(var w=b[0],A=h(y),M=h(x),T=new Array(A.length*M.length),k=0,E=0;E0){r=p[n];break}return r}function y(t,e){if(!(t<1||e<1)){for(var r=v(t),n=v(e),i=1,a=0;a_;)r--,r/=m(r),++r1?n:1},d.refineCoords=function(t){for(var e=this.dataScaleX,r=this.dataScaleY,n=t[0].shape[0],o=t[0].shape[1],s=0|Math.floor(t[0].shape[0]*e+1),l=0|Math.floor(t[0].shape[1]*r+1),u=1+n+1,c=1+o+1,f=i(new Float32Array(u*c),[u,c]),h=0;ha&&(this.minValues[e]=a),this.maxValues[e] 9: - warnings.warn('It seems you have created more than 10 ' - 'nilearn views. As each view uses dozens ' - 'of megabytes of RAM, you might want to ' - 'delete some of them.') - - def resize(self, width, height): - """Resize the plot displayed in a Jupyter notebook.""" - self.width, self.height = width, height - return self - - def get_iframe(self, width=None, height=None): - """ - Get the document wrapped in an inline frame. - - For inserting in another HTML page of for display in a Jupyter - notebook. - - """ - if width is None: - width = self.width - if height is None: - height = self.height - escaped = escape(self.html, quote=True) - wrapped = ('').format(escaped, width, height) - return wrapped - - def get_standalone(self): - """ Get the plot in an HTML page.""" - return self.html - - def _repr_html_(self): - """ - Used by the Jupyter notebook. - - Users normally won't call this method explicitely. - """ - return self.get_iframe() - - def __str__(self): - return self.html - - def save_as_html(self, file_name): - """ - Save the plot in an HTML file, that can later be opened in a browser. - """ - with open(file_name, 'wb') as f: - f.write(self.html.encode('utf-8')) - - def open_in_browser(self, file_name=None, temp_file_lifetime=30): - """ - Save the plot to a temporary HTML file and open it in a browser. - - Parameters - ---------- - - file_name : str, optional - .html file to use as temporary file - - temp_file_lifetime : float, optional (default=30.) - Time, in seconds, after which the temporary file is removed. - If None, it is never removed. - - """ - if file_name is None: - fd, file_name = tempfile.mkstemp('.html', 'nilearn_plot_') - os.close(fd) - self.save_as_html(file_name) - self._temp_file = file_name - file_size = os.path.getsize(file_name) / 1e6 - if temp_file_lifetime is None: - print(("Saved HTML in temporary file: {}\n" - "file size is {:.1f}M, delete it when you're done, " - "for example by calling this.remove_temp_file").format( - file_name, file_size)) - else: - _remove_after_n_seconds(self._temp_file, temp_file_lifetime) - webbrowser.open('file://{}'.format(file_name)) - - def remove_temp_file(self): - """ - Remove the temporary file created by `open_in_browser`, if necessary. - """ - if self._temp_file is None: - return - if not os.path.isfile(self._temp_file): - return - os.remove(self._temp_file) - print('removed {}'.format(self._temp_file)) - self._temp_file = None - - def colorscale(cmap, values, threshold=None, symmetric_cmap=True, vmax=None, vmin=None): """Normalize a cmap, put it in plotly format, get threshold and range.""" diff --git a/nilearn/plotting/matrix_plotting.py b/nilearn/plotting/matrix_plotting.py index 120177255d..075205a7fa 100644 --- a/nilearn/plotting/matrix_plotting.py +++ b/nilearn/plotting/matrix_plotting.py @@ -37,8 +37,10 @@ def plot_matrix(mat, title=None, labels=None, figure=None, axes=None, Matrix to be plotted. title : string or None, optional A text to add in the upper left corner. - labels : list of strings, optional - The label of each row and column + labels : list, ndarray of strings, empty list, False, or None, optional + The label of each row and column. Needs to be the same + length as rows/columns of mat. If False, None, or an + empty list, no labels are plotted. figure : figure instance, figsize tuple, or None Sets the figure used. This argument can be either an existing figure, or a pair (width, height) that gives the size of a @@ -80,8 +82,14 @@ def plot_matrix(mat, title=None, labels=None, figure=None, axes=None, display : instance of matplotlib Axes image. """ + # we need a list so an empty one will be cast to False + if isinstance(labels, np.ndarray): + labels = labels.tolist() + if labels and len(labels) != mat.shape[0]: + raise ValueError("Length of labels unequal to length of matrix.") + if reorder: - if labels is None or labels is False: + if not labels: raise ValueError("Labels are needed to show the reordering.") try: from scipy.cluster.hierarchy import (linkage, optimal_leaf_ordering, @@ -103,7 +111,7 @@ def plot_matrix(mat, title=None, labels=None, figure=None, axes=None, labels = np.array(labels).copy() mat = mat.copy() # and reorder labels and matrix - labels = labels[index] + labels = labels[index].tolist() mat = mat[index, :][:, index] if tri == 'lower': @@ -134,10 +142,10 @@ def plot_matrix(mat, title=None, labels=None, figure=None, axes=None, cmap=cmap, **kwargs) axes.set_autoscale_on(False) ymin, ymax = axes.get_ylim() - if labels is False: + if not labels: axes.xaxis.set_major_formatter(plt.NullFormatter()) axes.yaxis.set_major_formatter(plt.NullFormatter()) - elif labels is not None: + else: axes.set_xticks(np.arange(len(labels))) axes.set_xticklabels(labels, size='x-small') for label in axes.get_xticklabels(): @@ -178,7 +186,7 @@ def plot_matrix(mat, title=None, labels=None, figure=None, axes=None, axes.set_ylim(ymin, ymax) if auto_fit: - if labels is not None and labels is not False: + if labels: fit_axes(axes) elif own_fig: plt.tight_layout(pad=.1, diff --git a/nilearn/plotting/surf_plotting.py b/nilearn/plotting/surf_plotting.py index 0369256d82..fb25f762a9 100644 --- a/nilearn/plotting/surf_plotting.py +++ b/nilearn/plotting/surf_plotting.py @@ -514,7 +514,10 @@ def plot_surf_roi(surf_mesh, roi_map, bg_map=None, # messages in case of wrong inputs roi = load_surf_data(roi_map) - vmin, vmax = np.min(roi), 1 + np.max(roi) + if vmin is None: + vmin = np.min(roi) + if vmax is None: + vmax = 1 + np.max(roi) mesh = load_surf_mesh(surf_mesh) diff --git a/nilearn/plotting/tests/test_html_connectome.py b/nilearn/plotting/tests/test_html_connectome.py index 94c454fe81..50378f2173 100644 --- a/nilearn/plotting/tests/test_html_connectome.py +++ b/nilearn/plotting/tests/test_html_connectome.py @@ -53,8 +53,10 @@ def test_view_connectome(): adj, coord = _make_connectome() html = html_connectome.view_connectome(adj, coord) check_html(html, False, 'connectome-plot') - html = html_connectome.view_connectome(adj, coord, '85.3%') + html = html_connectome.view_connectome(adj, coord, '85.3%', + title="SOME_TITLE") check_html(html, False, 'connectome-plot') + assert "SOME_TITLE" in html.html html = html_connectome.view_connectome(adj, coord, '85.3%', linewidth=8.5, node_size=4.2) check_html(html, False, 'connectome-plot') @@ -63,7 +65,6 @@ def test_view_connectome(): check_html(html, False, 'connectome-plot') - def test_params_deprecation_view_connectome(): deprecated_params = {'coords': 'node_coords', 'threshold': 'edge_threshold', @@ -77,7 +78,7 @@ def test_params_deprecation_view_connectome(): warning_msgs = {old_: deprecation_msg.format(old_, new_) for old_, new_ in deprecated_params.items() } - + adj, coord = _make_connectome() with warnings.catch_warnings(record=True) as raised_warnings: html_connectome.view_connectome(adjacency_matrix=adj, @@ -127,12 +128,12 @@ def test_params_deprecation_view_connectome(): 4.2, ) old_params = ['coords', 'threshold', 'cmap', 'marker_size'] - + assert len(raised_warnings) == 4 for old_param_, raised_warning_ in zip(old_params, raised_warnings): assert warning_msgs[old_param_] == str(raised_warning_.message) assert raised_warning_.category is DeprecationWarning - + def test_get_markers(): coords = np.arange(12).reshape((4, 3)) diff --git a/nilearn/plotting/tests/test_html_surface.py b/nilearn/plotting/tests/test_html_surface.py index 3c31669d76..14a2b2950f 100644 --- a/nilearn/plotting/tests/test_html_surface.py +++ b/nilearn/plotting/tests/test_html_surface.py @@ -97,7 +97,7 @@ def test_fill_html_template(): info = html_surface.full_brain_info(img) html = html_surface._fill_html_template(info) check_html(html) - assert "* plotly.js (gl3d - minified) v1.38.3" in html.html + assert "* plotly.js (gl3d - minified) v1." in html.html def test_view_surf(): @@ -108,8 +108,10 @@ def test_view_surf(): fsaverage['sulc_right'], '90%') check_html(html) html = html_surface.view_surf(fsaverage['pial_right'], surf_map, - fsaverage['sulc_right'], .3) + fsaverage['sulc_right'], .3, + title="SOME_TITLE") check_html(html) + assert "SOME_TITLE" in html.html html = html_surface.view_surf(fsaverage['pial_right']) check_html(html) destrieux = datasets.fetch_atlas_surf_destrieux()['map_left'] @@ -132,7 +134,8 @@ def test_view_img_on_surf(): check_html(html) html = html_surface.view_img_on_surf(img, threshold=0, surf_mesh=fsaverage) check_html(html) - html = html_surface.view_img_on_surf(img, threshold=.4) + html = html_surface.view_img_on_surf(img, threshold=.4, title="SOME_TITLE") + assert "SOME_TITLE" in html.html check_html(html) html = html_surface.view_img_on_surf( img, threshold=.4, cmap='hot', black_bg=True) diff --git a/nilearn/plotting/tests/test_js_plotting_utils.py b/nilearn/plotting/tests/test_js_plotting_utils.py index 6320afbc0f..97154dcb07 100644 --- a/nilearn/plotting/tests/test_js_plotting_utils.py +++ b/nilearn/plotting/tests/test_js_plotting_utils.py @@ -2,26 +2,21 @@ import re import base64 import webbrowser -import time import tempfile import numpy as np import matplotlib -from numpy.testing import assert_warns, assert_no_warnings -try: - from lxml import etree - LXML_INSTALLED = True -except ImportError: - LXML_INSTALLED = False from nilearn.plotting import js_plotting_utils from nilearn import surface from nilearn.datasets import fetch_surf_fsaverage - -# Note: html output by nilearn view_* functions -# should validate as html5 using https://validator.w3.org/nu/ with no -# warnings +from numpy.testing import assert_warns +try: + from lxml import etree + LXML_INSTALLED = True +except ImportError: + LXML_INSTALLED = False def _normalize_ws(text): @@ -41,11 +36,7 @@ def test_add_js_lib(): assert _normalize_ws("""/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */""") in inline assert _normalize_ws("""** - * plotly.js (gl3d - minified) v1.38.3 - * Copyright 2012-2018, Plotly, Inc. - * All rights reserved. - * Licensed under the MIT license - */ """) in inline + * plotly.js (gl3d - minified)""") in inline assert "decodeBase64" in inline @@ -291,44 +282,6 @@ def _check_open_in_browser(html): pass -def test_temp_file_removing(): - html = js_plotting_utils.HTMLDocument('hello') - wb_open = webbrowser.open - webbrowser.open = _open_mock - try: - html.open_in_browser(temp_file_lifetime=.5) - assert os.path.isfile(html._temp_file) - time.sleep(1.5) - assert not os.path.isfile(html._temp_file) - html.open_in_browser(temp_file_lifetime=None) - assert os.path.isfile(html._temp_file) - time.sleep(1.5) - assert os.path.isfile(html._temp_file) - finally: - webbrowser.open = wb_open - try: - os.remove(html._temp_file) - except Exception: - pass - - -def _open_views(): - return [js_plotting_utils.HTMLDocument('') for i in range(12)] - - -def _open_one_view(): - for i in range(12): - v = js_plotting_utils.HTMLDocument('') - return v - - -def test_open_view_warning(): - # opening many views (without deleting the SurfaceView objects) - # should raise a warning about memory usage - assert_warns(UserWarning, _open_views) - assert_no_warnings(_open_one_view) - - def test_to_color_strings(): colors = [[0, 0, 1], [1, 0, 0], [.5, .5, .5]] as_str = js_plotting_utils.to_color_strings(colors) @@ -356,3 +309,8 @@ def test_to_color_strings(): colors = ['#0000ffff', '#ff0000ab', '#7f7f7f00'] as_str = js_plotting_utils.to_color_strings(colors) assert as_str == ['#0000ff', '#ff0000', '#7f7f7f'] + + +def test_import_html_document_from_js_plotting(): + from nilearn.plotting.js_plotting_utils import ( + HTMLDocument, set_max_img_views_before_warning) #noqa diff --git a/nilearn/plotting/tests/test_matrix_plotting.py b/nilearn/plotting/tests/test_matrix_plotting.py index 848089c295..9a1aa04939 100644 --- a/nilearn/plotting/tests/test_matrix_plotting.py +++ b/nilearn/plotting/tests/test_matrix_plotting.py @@ -10,7 +10,7 @@ def test_matrix_plotting(): - from numpy import zeros + from numpy import zeros, array from distutils.version import LooseVersion mat = zeros((10, 10)) labels = [str(i) for i in range(10)] @@ -21,6 +21,17 @@ def test_matrix_plotting(): # test if it returns an AxesImage ax.axes.set_title('Title') plt.close() + # test if an empty list works as an argument for labels + ax = plot_matrix(mat, labels=[]) + plt.close() + # test if an array gets correctly cast to a list + ax = plot_matrix(mat, labels=array(labels)) + plt.close() + # test if labels can be None + ax = plot_matrix(mat, labels=None) + plt.close() + assert_raises(ValueError, plot_matrix, mat, labels=[0, 1, 2]) + import scipy if LooseVersion(scipy.__version__) >= LooseVersion('1.0.0'): # test if a ValueError is raised when reorder=True without labels diff --git a/nilearn/plotting/tests/test_surf_plotting.py b/nilearn/plotting/tests/test_surf_plotting.py index e1e77c7b9a..73872e8f47 100644 --- a/nilearn/plotting/tests/test_surf_plotting.py +++ b/nilearn/plotting/tests/test_surf_plotting.py @@ -162,6 +162,14 @@ def test_plot_surf_roi(): # plot roi plot_surf_roi(mesh, roi_map=roi_map) plot_surf_roi(mesh, roi_map=roi_map, colorbar=True) + # change vmin, vmax + img = plot_surf_roi(mesh, roi_map=roi_map, + vmin=1.2, vmax=8.9, colorbar=True) + cbar = img.axes[-1] + cbar_vmin = float(cbar.get_yticklabels()[0].get_text()) + cbar_vmax = float(cbar.get_yticklabels()[-1].get_text()) + assert cbar_vmin == 1.2 + assert cbar_vmax == 8.9 # plot parcellation plot_surf_roi(mesh, roi_map=parcellation) diff --git a/nilearn/regions/parcellations.py b/nilearn/regions/parcellations.py index 1c4932ce9e..d37c3f8d7f 100644 --- a/nilearn/regions/parcellations.py +++ b/nilearn/regions/parcellations.py @@ -5,7 +5,7 @@ from sklearn.base import clone from sklearn.feature_extraction import image -from sklearn.externals.joblib import Memory, delayed, Parallel +from nilearn._utils.compat import Memory, delayed, Parallel from .rena_clustering import ReNA from ..decomposition.multi_pca import MultiPCA diff --git a/nilearn/regions/region_extractor.py b/nilearn/regions/region_extractor.py index a8fd9b4bfe..67cbba9564 100644 --- a/nilearn/regions/region_extractor.py +++ b/nilearn/regions/region_extractor.py @@ -9,7 +9,7 @@ from scipy import ndimage from scipy.stats import scoreatpercentile -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory from .. import masking from ..input_data import NiftiMapsMasker @@ -403,7 +403,7 @@ def fit(self, X=None, y=None): else: if self.thresholding_strategy == 'percentile': self.threshold = "{0}%".format(self.threshold) - threshold_maps = threshold_img(maps_img, mask_img=self.mask_img, + threshold_maps = threshold_img(maps_img, mask_img=self.mask_img, copy=True, threshold=self.threshold) # connected component extraction diff --git a/nilearn/regions/rena_clustering.py b/nilearn/regions/rena_clustering.py index e3dfaa5aa9..fac552aa5a 100644 --- a/nilearn/regions/rena_clustering.py +++ b/nilearn/regions/rena_clustering.py @@ -8,9 +8,9 @@ import warnings from scipy.sparse import csgraph, coo_matrix, dia_matrix try: - from sklearn.externals.joblib import Memory + from nilearn._utils.compat import Memory except ImportError: - from joblib import Memory + from nilearn._utils.compat import Memory from sklearn.base import TransformerMixin, ClusterMixin from sklearn.base import BaseEstimator from sklearn.utils.validation import check_is_fitted diff --git a/nilearn/regions/tests/test_rena_clustering.py b/nilearn/regions/tests/test_rena_clustering.py index d491c29795..6ae6e0515e 100644 --- a/nilearn/regions/tests/test_rena_clustering.py +++ b/nilearn/regions/tests/test_rena_clustering.py @@ -1,9 +1,9 @@ import numpy as np from nose.tools import assert_equal, assert_not_equal, assert_raises try: - from sklearn.externals.joblib import Memory + from nilearn._utils.compat import Memory except ImportError: - from joblib import Memory + from nilearn._utils.compat import Memory from nilearn._utils.data_gen import generate_fake_fmri from nilearn.regions.rena_clustering import ReNA from nilearn.input_data import NiftiMasker diff --git a/nilearn/reporting/__init__.py b/nilearn/reporting/__init__.py new file mode 100644 index 0000000000..2a97d557b5 --- /dev/null +++ b/nilearn/reporting/__init__.py @@ -0,0 +1,12 @@ +""" +Reporting code for nilearn +""" + +from .html_report import (ReportMixin, HTMLReport) + +from .html_document import (HTMLDocument, set_max_img_views_before_warning) + +from .sphinx_report import (_ReportScraper) + +__all__ = ['ReportMixin', 'HTMLDocument', 'HTMLReport', + 'set_max_img_views_before_warning', '_ReportScraper'] diff --git a/nilearn/reporting/data/README.txt b/nilearn/reporting/data/README.txt new file mode 100644 index 0000000000..9a9a58765f --- /dev/null +++ b/nilearn/reporting/data/README.txt @@ -0,0 +1,4 @@ +This directory contains files required for nilearn reporting. + +html/ : templates for HTML files +css/ : styling sheets diff --git a/nilearn/reporting/data/__init__.py b/nilearn/reporting/data/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/nilearn/reporting/data/html/__init__.py b/nilearn/reporting/data/html/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/nilearn/reporting/data/html/report_body_template.html b/nilearn/reporting/data/html/report_body_template.html new file mode 100644 index 0000000000..f662559f53 --- /dev/null +++ b/nilearn/reporting/data/html/report_body_template.html @@ -0,0 +1,226 @@ + + + + +
+

+ {{title}} + {{docstring}} +

+
+
+
+ image + {{if overlay}} +
+ overlay +
+ {{endif}} +
+
+
+

{{description}}

+

+
+ Parameters + + + + + + + + + + {{py: params = parameters.items()}} + {{for p, v in params}} + + + + + {{endfor}} + +
ParameterValue
{{p}}{{v}}
+ +
+
+
+
diff --git a/nilearn/reporting/data/html/report_head_template.html b/nilearn/reporting/data/html/report_head_template.html new file mode 100644 index 0000000000..4656912025 --- /dev/null +++ b/nilearn/reporting/data/html/report_head_template.html @@ -0,0 +1,18 @@ + + + + +HTML report + + + + + $body + + diff --git a/nilearn/reporting/html_document.py b/nilearn/reporting/html_document.py new file mode 100644 index 0000000000..9398497bb3 --- /dev/null +++ b/nilearn/reporting/html_document.py @@ -0,0 +1,151 @@ +import os +import weakref +import warnings +import tempfile +import webbrowser +import subprocess +from html import escape + +MAX_IMG_VIEWS_BEFORE_WARNING = 10 + + +def set_max_img_views_before_warning(new_value): + """Set the number of open views which triggers a warning. + + If `None` or a negative number, disable the memory warning. + """ + global MAX_IMG_VIEWS_BEFORE_WARNING + MAX_IMG_VIEWS_BEFORE_WARNING = new_value + + +def _remove_after_n_seconds(file_name, n_seconds): + script = os.path.join(os.path.dirname(__file__), 'rm_file.py') + subprocess.Popen(['python', script, file_name, str(n_seconds)]) + + +class HTMLDocument(object): + """ + Embeds a plot in a web page. + + If you are running a Jupyter notebook, the plot will be displayed + inline if this object is the output of a cell. + Otherwise, use open_in_browser() to open it in a web browser (or + save_as_html("filename.html") to save it as an html file). + + use str(document) or document.html to get the content of the web page, + and document.get_iframe() to have it wrapped in an iframe. + + """ + _all_open_html_repr = weakref.WeakSet() + + def __init__(self, html, width=600, height=400): + self.html = html + self.width = width + self.height = height + self._temp_file = None + self._check_n_open() + + def _check_n_open(self): + HTMLDocument._all_open_html_repr.add(self) + if MAX_IMG_VIEWS_BEFORE_WARNING is None: + return + if MAX_IMG_VIEWS_BEFORE_WARNING < 0: + return + if len(HTMLDocument._all_open_html_repr + ) > MAX_IMG_VIEWS_BEFORE_WARNING - 1: + warnings.warn('It seems you have created more than {} ' + 'nilearn views. As each view uses dozens ' + 'of megabytes of RAM, you might want to ' + 'delete some of them.'.format( + MAX_IMG_VIEWS_BEFORE_WARNING)) + + def resize(self, width, height): + """Resize the plot displayed in a Jupyter notebook.""" + self.width, self.height = width, height + return self + + def get_iframe(self, width=None, height=None): + """ + Get the document wrapped in an inline frame. + + For inserting in another HTML page of for display in a Jupyter + notebook. + + """ + if width is None: + width = self.width + if height is None: + height = self.height + escaped = escape(self.html, quote=True) + wrapped = ('').format(escaped, width, height) + return wrapped + + def get_standalone(self): + """ Get the plot in an HTML page.""" + return self.html + + def _repr_html_(self): + """ + Used by the Jupyter notebook. + + Users normally won't call this method explicitely. + """ + return self.get_iframe() + + def __str__(self): + return self.html + + def save_as_html(self, file_name): + """ + Save the plot in an HTML file, that can later be opened in a browser. + """ + with open(file_name, 'wb') as f: + f.write(self.get_standalone().encode('utf-8')) + + def open_in_browser(self, file_name=None, temp_file_lifetime=30): + """ + Save the plot to a temporary HTML file and open it in a browser. + + Parameters + ---------- + + file_name : str, optional + .html file to use as temporary file + + temp_file_lifetime : float, optional (default=30.) + Time, in seconds, after which the temporary file is removed. + If None, it is never removed. + + """ + if file_name is None: + fd, file_name = tempfile.mkstemp('.html', 'nilearn_plot_') + os.close(fd) + named_file = False + else: + named_file = True + self.save_as_html(file_name) + self._temp_file = file_name + file_size = os.path.getsize(file_name) / 1e6 + if temp_file_lifetime is None: + if not named_file: + warnings.warn( + ("Saved HTML in temporary file: {}\n" + "file size is {:.1f}M, delete it when you're done, " + "for example by calling this.remove_temp_file").format( + file_name, file_size)) + else: + _remove_after_n_seconds(self._temp_file, temp_file_lifetime) + webbrowser.open('file://{}'.format(file_name)) + + def remove_temp_file(self): + """ + Remove the temporary file created by `open_in_browser`, if necessary. + """ + if self._temp_file is None: + return + if not os.path.isfile(self._temp_file): + return + os.remove(self._temp_file) + print('removed {}'.format(self._temp_file)) + self._temp_file = None diff --git a/nilearn/reporting/html_report.py b/nilearn/reporting/html_report.py new file mode 100644 index 0000000000..dc2b95b9f0 --- /dev/null +++ b/nilearn/reporting/html_report.py @@ -0,0 +1,199 @@ +import io +import copy +import base64 +import warnings +from pathlib import Path +from string import Template + +from .html_document import HTMLDocument +from nilearn.externals import tempita + + +def _embed_img(display): + """ + Parameters + ---------- + display: obj + A Nilearn plotting object to display + + Returns + ------- + embed : str + Binary image string + """ + if display is None: # no image to display + return None + + else: # we were passed a matplotlib display + io_buffer = io.BytesIO() + display.frame_axes.figure.savefig(io_buffer, format='svg', + facecolor='white', + edgecolor='white') + display.close() + + io_buffer.seek(0) + data = base64.b64encode(io_buffer.read()) + + return '{}'.format(data.decode()) + + +def _str_params(params): + """ + Convert NoneType values to the string 'None' + for display. + + Parameters + ---------- + params: dict + A dictionary of input values to a function + """ + params_str = copy.deepcopy(params) + for k, v in params_str.items(): + if v is None: + params_str[k] = 'None' + return params_str + + +def _update_template(title, docstring, content, overlay, + parameters, description=None): + """ + Populate a report with content. + + Parameters + ---------- + title : str + The title for the report + docstring : str + The introductory docstring for the reported object + content : img + The content to display + overlay : img + Overlaid content, to appear on hover + parameters : dict + A dictionary of object parameters and their values + description : str + An optional description of the content + + Returns + ------- + HTMLReport : an instance of a populated HTML report + """ + resource_path = Path(__file__).resolve().parent.joinpath('data', 'html') + + body_template_name = 'report_body_template.html' + body_template_path = resource_path.joinpath(body_template_name) + tpl = tempita.HTMLTemplate.from_filename(str(body_template_path), + encoding='utf-8') + body = tpl.substitute(title=title, content=content, + overlay=overlay, + docstring=docstring, + parameters=parameters, + description=description) + + head_template_name = 'report_head_template.html' + head_template_path = resource_path.joinpath(head_template_name) + with open(str(head_template_path), 'r') as head_file: + head_tpl = Template(head_file.read()) + + return HTMLReport(body=body, head_tpl=head_tpl) + + +class ReportMixin: + """ + A class to provide general reporting functionality + """ + + def _define_overlay(self): + """ + Determine whether an overlay was provided and + update the report text as appropriate. + + Parameters + ---------- + + Returns + ------- + """ + displays = self._reporting() + + if len(displays) == 1: # set overlay to None + overlay, image = None, displays[0] + + elif len(displays) == 2: + overlay, image = displays[0], displays[1] + + return overlay, image + + def generate_report(self): + """ + Generate a report for Nilearn objects. + + Reports are useful to visualize steps in a processing pipeline. + Example use case: visualize the overlap of a mask and reference image + in NiftiMasker. + + Returns + ------- + report : HTMLReport + """ + if not hasattr(self, '_reporting_data'): + warnings.warn('This object has not been fitted yet ! ' + 'Make sure to run `fit` before inspecting reports.') + report = _update_template(title='Empty Report', + docstring=('This report was not ' + 'generated. Please `fit` the ' + 'object.'), + content=_embed_img(None), + overlay=None, + parameters=dict()) + + elif self._reporting_data is None: + warnings.warn('Report generation not enabled ! ' + 'No visual outputs will be created.') + report = _update_template(title='Empty Report', + docstring=('This report was not ' + 'generated. Please check ' + 'that reporting is enabled.'), + content=_embed_img(None), + overlay=None, + parameters=dict()) + + else: # We can create a report + overlay, image = self._define_overlay() + description = self._report_description + parameters = _str_params(self.get_params()) + docstring = self.__doc__ + snippet = docstring.partition('Parameters\n ----------\n')[0] + report = _update_template(title=self.__class__.__name__, + docstring=snippet, + content=_embed_img(image), + overlay=_embed_img(overlay), + parameters=parameters, + description=description) + return report + + +class HTMLReport(HTMLDocument): + """ + A report written as HTML. + Methods such as save_as_html(), open_in_browser() + are inherited from HTMLDocument + """ + def __init__(self, head_tpl, body): + """ The head_tpl is meant for display as a full page, eg writing on + disk. The body is used for embedding in an existing page. + """ + html = head_tpl.substitute(body=body) + super(HTMLReport, self).__init__(html) + self.head_tpl = head_tpl + self.body = body + + def _repr_html_(self): + """ + Used by the Jupyter notebook. + Users normally won't call this method explicitly. + """ + return self.body + + def __str__(self): + return self.body diff --git a/nilearn/plotting/rm_file.py b/nilearn/reporting/rm_file.py similarity index 100% rename from nilearn/plotting/rm_file.py rename to nilearn/reporting/rm_file.py diff --git a/nilearn/reporting/sphinx_report.py b/nilearn/reporting/sphinx_report.py new file mode 100644 index 0000000000..814ec3336f --- /dev/null +++ b/nilearn/reporting/sphinx_report.py @@ -0,0 +1,48 @@ +# Scraper for sphinx-gallery +# Inspired from https://github.com/mne-tools/mne-python/ +import weakref + +from nilearn.reporting import HTMLDocument + + +_SCRAPER_TEXT = ''' +.. only:: builder_html + + .. container:: row sg-report + + .. raw:: html + + {0} + +''' # noqa: E501 + + +def indent_and_escape(text, amount=12): + "Indent, skip empty lines, and escape string delimiters" + return (''.join(amount * ' ' + line.replace("'", '"') + for line in text.splitlines(True) + if line) + amount * ' ') + + +class _ReportScraper: + """Scrape Reports for Sphinx display. + """ + + def __init__(self): + self.app = None + self.displayed_reports = weakref.WeakSet() + + def __repr__(self): + return '' + + def __call__(self, block, block_vars, gallery_conf): + for report in block_vars['example_globals'].values(): + if (isinstance(report, HTMLDocument) and + gallery_conf['builder_name'] == 'html'): + if report in self.displayed_reports: + continue + report_str = report._repr_html_() + data = _SCRAPER_TEXT.format(indent_and_escape(report_str)) + self.displayed_reports.add(report) + return data + return '' diff --git a/nilearn/reporting/tests/__init__.py b/nilearn/reporting/tests/__init__.py new file mode 100644 index 0000000000..20f6b77ed9 --- /dev/null +++ b/nilearn/reporting/tests/__init__.py @@ -0,0 +1,3 @@ +""" +Testing reporting code in nilearn +""" diff --git a/nilearn/reporting/tests/test_html_document.py b/nilearn/reporting/tests/test_html_document.py new file mode 100644 index 0000000000..87b5817f04 --- /dev/null +++ b/nilearn/reporting/tests/test_html_document.py @@ -0,0 +1,74 @@ +import os +import time +import pytest +import tempfile +import webbrowser +from nilearn import reporting + +from numpy.testing import assert_warns, assert_no_warnings + +# Note: html output by nilearn view_* functions +# should validate as html5 using https://validator.w3.org/nu/ with no +# warnings + + +def _open_mock(f): + print('opened {}'.format(f)) + + +def test_temp_file_removing(): + html = reporting.HTMLDocument('hello') + wb_open = webbrowser.open + webbrowser.open = _open_mock + fd, tmpfile = tempfile.mkstemp() + try: + os.close(fd) + with pytest.warns(None) as record: + html.open_in_browser(file_name=tmpfile, temp_file_lifetime=None) + for warning in record: + assert "Saved HTML in temporary file" not in str(warning.message) + html.open_in_browser(temp_file_lifetime=0.5) + assert os.path.isfile(html._temp_file) + time.sleep(1.5) + assert not os.path.isfile(html._temp_file) + with pytest.warns(UserWarning, match="Saved HTML in temporary file"): + html.open_in_browser(temp_file_lifetime=None) + html.open_in_browser(temp_file_lifetime=None) + assert os.path.isfile(html._temp_file) + time.sleep(1.5) + assert os.path.isfile(html._temp_file) + finally: + webbrowser.open = wb_open + try: + os.remove(html._temp_file) + except Exception: + pass + try: + os.remove(tmpfile) + except Exception: + pass + + +def _open_views(): + return [reporting.HTMLDocument('') for i in range(12)] + + +def _open_one_view(): + for i in range(12): + v = reporting.HTMLDocument('') + return v + + +def test_open_view_warning(): + # opening many views (without deleting the SurfaceView objects) + # should raise a warning about memory usage + assert_warns(UserWarning, _open_views) + assert_no_warnings(_open_one_view) + reporting.set_max_img_views_before_warning(15) + assert_no_warnings(_open_views) + reporting.set_max_img_views_before_warning(-1) + assert_no_warnings(_open_views) + reporting.set_max_img_views_before_warning(None) + assert_no_warnings(_open_views) + reporting.set_max_img_views_before_warning(6) + assert_warns(UserWarning, _open_views) diff --git a/nilearn/reporting/tests/test_html_report.py b/nilearn/reporting/tests/test_html_report.py new file mode 100644 index 0000000000..1c1499fd76 --- /dev/null +++ b/nilearn/reporting/tests/test_html_report.py @@ -0,0 +1,102 @@ +import pytest +import numpy as np +from nibabel import Nifti1Image +from nilearn import input_data +from numpy.testing import assert_warns + + +# Note: html output by nilearn view_* functions +# should validate as html5 using https://validator.w3.org/nu/ with no +# warnings + + +def _check_html(html_view): + """ Check the presence of some expected code in the html viewer + """ + assert "Parameters" in str(html_view) + assert "data:image/svg+xml;base64," in str(html_view) + + +def test_3d_reports(): + # Dummy 3D data + data = np.zeros((9, 9, 9)) + data[3:-3, 3:-3, 3:-3] = 10 + data_img_3d = Nifti1Image(data, np.eye(4)) + + # Dummy mask + mask = np.zeros((9, 9, 9)) + mask[4:-4, 4:-4, 4:-4] = True + mask_img_3d = Nifti1Image(data, np.eye(4)) + + # test .fit method + mask = input_data.NiftiMasker() + mask.fit(data_img_3d) + html = mask.generate_report() + _check_html(html) + + # check providing mask to init + masker = input_data.NiftiMasker(mask_img=mask_img_3d) + masker.fit(data_img_3d) + html = masker.generate_report() + _check_html(html) + + # check providing mask to init and no images to .fit + masker = input_data.NiftiMasker(mask_img=mask_img_3d) + masker.fit() + html = masker.generate_report() + _check_html(html) + + +def test_4d_reports(): + # Dummy 4D data + data = np.zeros((10, 10, 10, 3), dtype=int) + data[..., 0] = 1 + data[..., 1] = 2 + data[..., 2] = 3 + data_img_4d = Nifti1Image(data, np.eye(4)) + + # Dummy mask + mask = np.zeros((10, 10, 10), dtype=int) + mask[3:7, 3:7, 3:7] = 1 + mask_img = Nifti1Image(mask, np.eye(4)) + + # test .fit method + mask = input_data.NiftiMasker(mask_strategy='epi') + mask.fit(data_img_4d) + html = mask.generate_report() + _check_html(html) + + # test .fit_transform method + masker = input_data.NiftiMasker(mask_img=mask_img, standardize=True) + masker.fit_transform(data_img_4d) + html = masker.generate_report() + _check_html(html) + + +def _generate_empty_report(): + data = np.zeros((9, 9, 9)) + data[3:-3, 3:-3, 3:-3] = 10 + data_img_3d = Nifti1Image(data, np.eye(4)) + + # turn off reporting + mask = input_data.NiftiMasker(reports=False) + mask.fit(data_img_3d) + mask.generate_report() + + +def test_empty_report(): + assert_warns(UserWarning, _generate_empty_report) + + +def test_overlaid_report(): + pytest.importorskip('matplotlib') + + # Dummy 3D data + data = np.zeros((9, 9, 9)) + data[3:-3, 3:-3, 3:-3] = 10 + data_img_3d = Nifti1Image(data, np.eye(4)) + + mask = input_data.NiftiMasker(target_affine=np.eye(3) * 8) + mask.fit(data_img_3d) + html = mask.generate_report() + assert '
' in str(html) diff --git a/nilearn/reporting/tests/test_sphinx_report.py b/nilearn/reporting/tests/test_sphinx_report.py new file mode 100644 index 0000000000..7a44306777 --- /dev/null +++ b/nilearn/reporting/tests/test_sphinx_report.py @@ -0,0 +1,45 @@ +import numpy as np +import os.path as op +from nibabel import Nifti1Image +from sklearn.utils import Bunch +from nilearn.input_data import NiftiMasker +from nilearn.reporting import _ReportScraper + + +def _gen_report(): + """ Generate an empty HTMLReport for testing """ + + data = np.zeros((9, 9, 9)) + data[3:-3, 3:-3, 3:-3] = 10 + data_img_3d = Nifti1Image(data, np.eye(4)) + + # turn off reporting + mask = NiftiMasker() + mask.fit(data_img_3d) + report = mask.generate_report() + return report + + +def test_scraper(tmpdir): + """Test report scraping.""" + # Mock a Sphinx + sphinx_gallery config + app = Bunch(builder=Bunch(srcdir=str(tmpdir), + outdir=op.join(str(tmpdir), '_build', 'html'))) + scraper = _ReportScraper() + scraper.app = app + gallery_conf = dict(src_dir=app.builder.srcdir, builder_name='html') + img_fname = op.join(app.builder.srcdir, 'auto_examples', 'images', + 'sg_img.png') + target_file = op.join(app.builder.srcdir, 'auto_examples', 'sg.py') + block_vars = dict(image_path_iterator=(img for img in [img_fname]), + example_globals=dict(a=1), target_file=target_file) + # Confirm that HTML isn't accidentally inserted + block = None + rst = scraper(block, block_vars, gallery_conf) + assert rst == '' + + # Confirm that HTML is correctly inserted for HTMLReport + report = _gen_report() + block_vars['example_globals']['report'] = report + rst = scraper(block, block_vars, gallery_conf) + assert " np.finfo(np.float).eps * 100.] signals -= Q.dot(Q.T).dot(signals) - if standardize: - signals = _standardize(signals, normalize=True, detrend=False) - signals *= np.sqrt(signals.shape[0]) # for unit variance + # Standardize + if detrend and (standardize == 'psc'): + # If the signal is detrended, we have to know the original mean + # signal to calculate the psc. + signals = _standardize(signals + mean_signals, standardize=standardize, + detrend=False) + else: + signals = _standardize(signals, standardize=standardize, + detrend=False) return signals diff --git a/nilearn/surface/surface.py b/nilearn/surface/surface.py index d17b0a27a8..fac0282204 100644 --- a/nilearn/surface/surface.py +++ b/nilearn/surface/surface.py @@ -236,7 +236,7 @@ def _masked_indices(sample_locations, img_shape, mask=None): for dim, size in enumerate(img_shape): kept = np.logical_and(kept, sample_locations[:, dim] < size) if mask is not None: - indices = np.asarray(np.round(sample_locations[kept]), dtype=int) + indices = np.asarray(np.floor(sample_locations[kept]), dtype=int) kept[kept] = mask[ indices[:, 0], indices[:, 1], indices[:, 2]] != 0 return ~kept diff --git a/nilearn/tests/test_cache_mixin.py b/nilearn/tests/test_cache_mixin.py index 0578c60a68..7f9b711a68 100644 --- a/nilearn/tests/test_cache_mixin.py +++ b/nilearn/tests/test_cache_mixin.py @@ -10,7 +10,7 @@ import sklearn from nose.tools import assert_false, assert_true, assert_equal -from sklearn.externals.joblib import Memory +from nilearn._utils.compat import Memory import nilearn from nilearn._utils import cache_mixin, CacheMixin diff --git a/nilearn/tests/test_extmath.py b/nilearn/tests/test_extmath.py index 589948a5c2..ad0093cb17 100644 --- a/nilearn/tests/test_extmath.py +++ b/nilearn/tests/test_extmath.py @@ -15,7 +15,7 @@ def test_fast_abs_percentile(): data = np.arange(100) rng.shuffle(data) for p in data: - yield nose.tools.assert_equal, fast_abs_percentile(data, p), p + nose.tools.assert_equal(fast_abs_percentile(data, p), p) def test_is_spd_with_non_symmetrical_matrix(): diff --git a/nilearn/tests/test_niimg.py b/nilearn/tests/test_niimg.py index dfc4900e02..3127c982d5 100644 --- a/nilearn/tests/test_niimg.py +++ b/nilearn/tests/test_niimg.py @@ -6,7 +6,7 @@ import nibabel as nb from nibabel import Nifti1Image from nibabel.tmpdirs import InTemporaryDirectory -from sklearn.externals import joblib +from nilearn._utils.compat import joblib from nilearn.image import new_img_like from nilearn._utils import niimg diff --git a/nilearn/tests/test_signal.py b/nilearn/tests/test_signal.py index 6616dffbef..9fcdddaccd 100644 --- a/nilearn/tests/test_signal.py +++ b/nilearn/tests/test_signal.py @@ -189,20 +189,20 @@ def test_standardize(): # transpose array to fit _standardize input. # Without trend removal - b = nisignal._standardize(a, normalize=True) - energies = (b ** 2).sum(axis=0) - np.testing.assert_almost_equal(energies, np.ones(n_features)) + b = nisignal._standardize(a, standardize='zscore') + stds = np.std(b) + np.testing.assert_almost_equal(stds, np.ones(n_features)) np.testing.assert_almost_equal(b.sum(axis=0), np.zeros(n_features)) # With trend removal a = np.atleast_2d(np.linspace(0, 2., n_features)).T - b = nisignal._standardize(a, detrend=True, normalize=False) + b = nisignal._standardize(a, detrend=True, standardize=False) np.testing.assert_almost_equal(b, np.zeros(b.shape)) length_1_signal = np.atleast_2d(np.linspace(0, 2., n_features)) np.testing.assert_array_equal(length_1_signal, nisignal._standardize(length_1_signal, - normalize=True)) + standardize='zscore')) def test_detrend(): @@ -227,8 +227,9 @@ def test_detrend(): # "x" must be left untouched np.testing.assert_almost_equal(original, x, decimal=14) - assert_true(abs(detrended.mean(axis=0)).max() < - 15. * np.finfo(np.float).eps) + assert_true( + abs(detrended.mean(axis=0)).max() < 15. * np.finfo(np.float).eps + ) np.testing.assert_almost_equal(detrended_scipy, detrended, decimal=14) # for this to work, there must be no trends at all in "signals" np.testing.assert_almost_equal(detrended, signals, decimal=14) @@ -328,7 +329,8 @@ def test_clean_t_r(): 'n_samples={}, n_features={}'.format( tr1, tr2, low_cutoff, high_cutoff, n_samples, n_features)) - np.testing.assert_(np.any(np.not_equal(det_one_tr, det_diff_tr)), + np.testing.assert_(np.any(np.not_equal(det_one_tr, + det_diff_tr)), msg) del det_one_tr, det_diff_tr @@ -442,9 +444,7 @@ def test_clean_confounds(): np.zeros((20, 2))) - - -def test_clean_frequencies(): +def test_clean_frequencies_using_power_spectrum_density(): # Create signal sx = np.array([np.sin(np.linspace(0, 100, 100) * 1.5), @@ -463,7 +463,7 @@ def test_clean_frequencies(): res_low = clean(sx, detrend=False, standardize=False, low_pass=low_pass, high_pass=None, t_r=t_r) res_high = clean(sx, detrend=False, standardize=False, low_pass=None, - high_pass=high_pass, t_r=t_r) + high_pass=high_pass, t_r=t_r) # Compute power spectrum density for both test f, Pxx_den_low = scipy.signal.welch(np.mean(res_low.T, axis=0), fs=t_r) @@ -474,6 +474,31 @@ def test_clean_frequencies(): assert_true(np.sum(Pxx_den_high[f <= high_pass / 2.]) <= 1e-4) +def test_clean_finite_no_inplace_mod(): + """ + Test for verifying that the passed in signal array is not modified. + For PR #2125 . This test is failing on master, passing in this PR. + """ + rng = np.random.RandomState(0) + n_samples = 2 + # n_features Must be higher than 500 + n_features = 501 + x_orig, _, _ = generate_signals(n_features=n_features, + length=n_samples) + x_orig_inital_copy = x_orig.copy() + + x_orig_with_nans = x_orig.copy() + x_orig_with_nans[0, 0] = np.nan + x_orig_with_nans_initial_copy = x_orig_with_nans.copy() + + cleaned_x_orig = clean(x_orig) + assert np.array_equal(x_orig, x_orig_inital_copy) + + cleaned_x_orig_with_nans = clean(x_orig_with_nans, ensure_finite=True) + assert np.isnan(x_orig_with_nans_initial_copy[0, 0]) + assert np.isnan(x_orig_with_nans[0, 0]) + + def test_high_variance_confounds(): # C and F order might take different paths in the function. Check that the @@ -533,3 +558,36 @@ def test_high_variance_confounds(): np.testing.assert_almost_equal( np.min(np.abs(np.dstack([outG - outGt, outG + outGt])), axis=2), np.zeros(outG.shape)) + + +def test_clean_psc(): + rng = np.random.RandomState(0) + n_samples = 500 + n_features = 5 + + signals, _, _ = generate_signals(n_features=n_features, + length=n_samples) + means = rng.randn(1, n_features) + signals += means + + cleaned_signals = clean(signals, standardize='psc') + np.testing.assert_almost_equal(cleaned_signals.mean(0), 0) + + cleaned_signals.std(axis=0) + np.testing.assert_almost_equal(cleaned_signals.mean(0), 0) + np.testing.assert_almost_equal(cleaned_signals, + signals / signals.mean(0) * 100 - 100) + + +def test_clean_zscore(): + rng = np.random.RandomState(0) + n_samples = 500 + n_features = 5 + + signals, _, _ = generate_signals(n_features=n_features, + length=n_samples) + + signals += rng.randn(1, n_features) + cleaned_signals = clean(signals, standardize='zscore') + np.testing.assert_almost_equal(cleaned_signals.mean(0), 0) + np.testing.assert_almost_equal(cleaned_signals.std(0), 1) diff --git a/nilearn/version.py b/nilearn/version.py index 8c4bf2dcfa..913654d4f5 100644 --- a/nilearn/version.py +++ b/nilearn/version.py @@ -41,6 +41,10 @@ 'min_version': '0.19', 'required_at_installation': True, 'install_info': _NILEARN_INSTALL_MSG}), + ('joblib', { + 'min_version': '0.11', + 'required_at_installation': True, + 'install_info': _NILEARN_INSTALL_MSG}), ('nibabel', { 'min_version': '2.0.2', 'required_at_installation': False})) diff --git a/requirements-build-docs.txt b/requirements-build-docs.txt index 88aad0f937..27e6262424 100644 --- a/requirements-build-docs.txt +++ b/requirements-build-docs.txt @@ -17,4 +17,5 @@ pandas nose-timer nibabel scikit-learn +joblib matplotlib diff --git a/requirements-dev.txt b/requirements-dev.txt index 1ae2fca753..e73c47dc6a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,8 +1,9 @@ nose +pytest +pytest-cov coverage -boto3 -patsy scipy scikit-learn +joblib pandas matplotlib diff --git a/setup.cfg b/setup.cfg index 48ddd82a97..3e61ea08c1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,17 +3,6 @@ [bdist_rpm] doc-files = doc -[nosetests] -verbosity = 2 -detailed-errors = 1 -with-coverage = 1 -cover-package = nilearn -#pdb = 1 -#pdb-failures = 1 -with-doctest=1 -doctest-extension=rst -ignore-files=(plot_.*.py|conf\.py) - [wheel] universal=1 @@ -22,3 +11,12 @@ universal=1 # http://pep8.readthedocs.org/en/latest/intro.html#error-codes # E402: module level import not at top of file ignore=E402 + +[tool:pytest] +doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS +junit_family = xunit2 +addopts = + --doctest-modules + -s + -vv + --durations=0 diff --git a/setup.py b/setup.py index 355e6de4ab..a88c17ae81 100755 --- a/setup.py +++ b/setup.py @@ -97,5 +97,6 @@ def is_installing(): 'nilearn.image.tests.data': ['*.mgz'], 'nilearn.surface.tests.data': ['*.annot', '*.label'], 'nilearn.datasets.tests.data': ['*.*'], - 'nilearn.datasets.description': ['*.rst']}, + 'nilearn.datasets.description': ['*.rst'], + 'nilearn.reporting.data.html': ['*.html']}, install_requires=install_requires,)